internal/godoc/dochtml: prefix old HTML with legacy
The current HTML is prefixed with legacy and moved to legacy_*.go files,
since it will soon be deprecated in favor of templates for the redesign.
Change-Id: I704f836a56d8ac5ce4ed168932cf9f7ab356fc2a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259000
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/godoc/dochtml/template_body.go b/internal/godoc/dochtml/legacy_body.go
similarity index 99%
rename from internal/godoc/dochtml/template_body.go
rename to internal/godoc/dochtml/legacy_body.go
index 887243f..3c8e799 100644
--- a/internal/godoc/dochtml/template_body.go
+++ b/internal/godoc/dochtml/legacy_body.go
@@ -9,7 +9,7 @@
IdentifierBodyEnd = `</div>`
)
-const tmplBody = `
+const legacyTmplBody = `
` + IdentifierBodyStart + ` {{/* Documentation content container */}}
diff --git a/internal/godoc/dochtml/template_sidenav.go b/internal/godoc/dochtml/legacy_sidenav.go
similarity index 99%
rename from internal/godoc/dochtml/template_sidenav.go
rename to internal/godoc/dochtml/legacy_sidenav.go
index 5cd57fc..7528640 100644
--- a/internal/godoc/dochtml/template_sidenav.go
+++ b/internal/godoc/dochtml/legacy_sidenav.go
@@ -10,7 +10,7 @@
IdentifierSidenavEnd = `</nav>`
)
-const tmplSidenav = `
+const legacyTmplSidenav = `
{{if or .Doc .Consts .Vars .Funcs .Types .Examples.List}}
` + IdentifierSidenavStart + `
<ul role="tree" aria-label="Outline">
diff --git a/internal/godoc/dochtml/template.go b/internal/godoc/dochtml/template.go
index 4c7c7e8..1ceef3f 100644
--- a/internal/godoc/dochtml/template.go
+++ b/internal/godoc/dochtml/template.go
@@ -16,10 +16,10 @@
// TODO(golang.org/issue/5060): finalize URL scheme and design for notes,
// then it becomes more viable to factor out inline CSS style.
func htmlPackage() *template.Template {
- return template.Must(template.New("package").Funcs(tmpl).Parse(tmplHTML))
+ return template.Must(template.New("package").Funcs(tmpl).Parse(legacyTmplHTML))
}
-const tmplHTML = `{{- "" -}}` + tmplSidenav + tmplBody + tmplExample
+const legacyTmplHTML = `{{- "" -}}` + legacyTmplSidenav + legacyTmplBody + tmplExample
var tmpl = map[string]interface{}{
"ternary": func(q, a, b interface{}) interface{} {
diff --git a/internal/godoc/dochtml/template_test.go b/internal/godoc/dochtml/template_test.go
index 37d46d1..62443d2 100644
--- a/internal/godoc/dochtml/template_test.go
+++ b/internal/godoc/dochtml/template_test.go
@@ -11,7 +11,7 @@
)
func TestTemplate(t *testing.T) {
- if diff := cmp.Diff(fullTemplate, tmplHTML); diff != "" {
+ if diff := cmp.Diff(fullTemplate, legacyTmplHTML); diff != "" {
t.Errorf("mismatch (-want +got):\n%s", diff)
}
}