1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:04:42 -07:00

godoc/static: replace version strings with actual versions

This will allow the source installation instructions to
always show the current version, but only when that version
is a release version.

Fixes golang/go#14371

Change-Id: Ibfad8054f3c75d9320ca94ba5149ab9bf052157e
Reviewed-on: https://go-review.googlesource.com/22056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Andrew Gerrand 2016-04-14 12:13:35 +10:00
parent 5da1e91fb2
commit 3868f57059
3 changed files with 20 additions and 0 deletions

View File

@ -100,6 +100,7 @@ and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
{{if .Playground}}
<script type="text/javascript" src="/lib/godoc/playground.js"></script>
{{end}}
{{with .Version}}<script>var goVersion = {{printf "%q" .}};</script>{{end}}
<script type="text/javascript" src="/lib/godoc/godocs.js"></script>
</body>

View File

@ -297,6 +297,14 @@ function personalizeInstallInstructions() {
window.location = download;
}
function updateVersionTags() {
var v = window.goVersion;
if (/^go[0-9.]+$/.test(v)) {
$(".versionTag").empty().text(v);
$(".whereTag").hide();
}
}
$(document).ready(function() {
bindSearchEvents();
generateTOC();
@ -313,6 +321,7 @@ $(document).ready(function() {
setupCallgraphs();
toggleHash();
personalizeInstallInstructions();
updateVersionTags();
// godoc.html defines window.initFuncs in the <head> tag, and root.html and
// codewalk.js push their on-page-ready functions to the list.

View File

@ -560,6 +560,7 @@ and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
{{if .Playground}}
<script type="text/javascript" src="/lib/godoc/playground.js"></script>
{{end}}
{{with .Version}}<script>var goVersion = {{printf "%q" .}};</script>{{end}}
<script type="text/javascript" src="/lib/godoc/godocs.js"></script>
</body>
@ -866,6 +867,14 @@ function personalizeInstallInstructions() {
window.location = download;
}
function updateVersionTags() {
var v = window.goVersion;
if (/^go[0-9.]+$/.test(v)) {
$(".versionTag").empty().text(v);
$(".whereTag").hide();
}
}
$(document).ready(function() {
bindSearchEvents();
generateTOC();
@ -882,6 +891,7 @@ $(document).ready(function() {
setupCallgraphs();
toggleHash();
personalizeInstallInstructions();
updateVersionTags();
// godoc.html defines window.initFuncs in the <head> tag, and root.html and
// codewalk.js push their on-page-ready functions to the list.