mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
Show current version
This commit is contained in:
parent
075c67a84c
commit
9e03c28c67
30
_docs/gen.go
30
_docs/gen.go
@ -17,10 +17,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -52,12 +54,20 @@ func init() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
devVersion = string(b)
|
||||
stableVersion = strings.TrimSpace(string(b))
|
||||
}
|
||||
|
||||
func init() {
|
||||
b, err := exec.Command("git", "show", "master:version.txt").Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
devVersion = strings.TrimSpace(string(b))
|
||||
}
|
||||
|
||||
func comment(text string) template.HTML {
|
||||
// TODO: text should be escaped
|
||||
return template.HTML("<!--" + text + "-->")
|
||||
return template.HTML("<!--\n" + text + "\n-->")
|
||||
}
|
||||
|
||||
func safeHTML(text string) template.HTML {
|
||||
@ -97,14 +107,7 @@ func (e *example) Source() string {
|
||||
}
|
||||
|
||||
func versions() string {
|
||||
vers := []string{}
|
||||
if stableVersion != "" {
|
||||
vers = append(vers, "Stable: "+stableVersion)
|
||||
}
|
||||
if devVersion != "" {
|
||||
vers = append(vers, "Development: "+devVersion)
|
||||
}
|
||||
return strings.Join(vers, ", ")
|
||||
return fmt.Sprintf("v%s (dev: v%s)", stableVersion, devVersion)
|
||||
}
|
||||
|
||||
func main() {
|
||||
@ -132,9 +135,10 @@ func main() {
|
||||
{Name: "rotate"},
|
||||
}
|
||||
data := map[string]interface{}{
|
||||
"License": license,
|
||||
"Versions": versions(),
|
||||
"Examples": examples,
|
||||
"License": license,
|
||||
"StableVersion": stableVersion,
|
||||
"DevVersion": devVersion,
|
||||
"Examples": examples,
|
||||
}
|
||||
if err := t.Funcs(funcs).Execute(f, data); err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -21,7 +21,7 @@ table.examples td.code pre {
|
||||
}
|
||||
</style>
|
||||
<h1>Ebiten (海老天)</h1>
|
||||
<p>{{.Versions}}</p>
|
||||
<p>v{{.StableVersion}}</p>
|
||||
<ul>
|
||||
<li>A simple SNES-like 2D game library in Go</li>
|
||||
<li>Works on
|
||||
@ -32,7 +32,7 @@ table.examples td.code pre {
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li>
|
||||
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a></li>
|
||||
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a> (Development version: v{{.DevVersion}})</li>
|
||||
</ul>
|
||||
|
||||
<h2>Features</h2>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<!--Copyright 2014 Hajime Hoshi
|
||||
<!--
|
||||
Copyright 2014 Hajime Hoshi
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -12,6 +13,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
<link rel="shortcut icon" href="./favicon.png" type="image/png" >
|
||||
<link rel="icon" href="./favicon.png" type="image/png" >
|
||||
@ -34,8 +36,7 @@ table.examples td.code pre {
|
||||
}
|
||||
</style>
|
||||
<h1>Ebiten (海老天)</h1>
|
||||
<p>Development: 1.0.0-alpha
|
||||
</p>
|
||||
<p>v1.0.0-alpha</p>
|
||||
<ul>
|
||||
<li>A simple SNES-like 2D game library in Go</li>
|
||||
<li>Works on
|
||||
@ -46,7 +47,7 @@ table.examples td.code pre {
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="http://godoc.org/github.com/hajimehoshi/ebiten">API Docs</a></li>
|
||||
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a></li>
|
||||
<li><a href="http://github.com/hajimehoshi/ebiten">Source Code</a> (Development Version: v1.0.0-alpha)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Features</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user