Commit 0f801ff8 authored by Robert Griesemer's avatar Robert Griesemer

godoc: template cleanup

Use naming convention for template variables
to indicate "escaped-ness" for easier reviewing.
(per suggestion from bradfitz)

R=bradfitz
CC=golang-dev
https://golang.org/cl/4914041
parent 75cb0842
......@@ -7,8 +7,8 @@
<table class="layout">
{{range .}}
<tr>
{{$name := html .Name}}
<td><a href="{{$name}}">{{$name}}</a></td>
{{$name_html := html .Name}}
<td><a href="{{$name_html}}">{{$name_html}}</a></td>
<td width="25">&nbsp;</td>
<td>{{html .Title}}</td>
</tr>
......
......@@ -18,12 +18,12 @@
</tr>
{{range .}}
<tr>
{{$name := .|fileInfoName|html}}
<td align="left"><a href="{{$name}}">{{$name}}</a></td>
{{$name_html := fileInfoName . | html}}
<td align="left"><a href="{{$name_html}}">{{$name_html}}</a></td>
<td></td>
<td align="right">{{html .Size}}</td>
<td></td>
<td align="left">{{.|fileInfoTime|html}}</td>
<td align="left">{{fileInfoTime . | html}}</td>
</tr>
{{end}}
......
......@@ -41,16 +41,16 @@
{{with .Funcs}}
{{range .}}
{{/* Name is a string - no need for FSet */}}
{{$name := html .Name}}
<h2 id="{{$name}}">func <a href="/{{posLink_url .Decl $.FSet}}">{{$name}}</a></h2>
{{$name_html := html .Name}}
<h2 id="{{$name_html}}">func <a href="/{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h2>
<p><code>{{node_html .Decl $.FSet}}</code></p>
{{comment_html .Doc}}
{{end}}
{{end}}
{{with .Types}}
{{range .}}
{{$tname := node_html .Type.Name $.FSet}}
<h2 id="{{$tname}}">type <a href="/{{posLink_url .Decl $.FSet}}">{{$tname}}</a></h2>
{{$tname_html := node_html .Type.Name $.FSet}}
<h2 id="{{$tname_html}}">type <a href="/{{posLink_url .Decl $.FSet}}">{{$tname_html}}</a></h2>
{{comment_html .Doc}}
<p><pre>{{node_html .Decl $.FSet}}</pre></p>
{{range .Consts}}
......@@ -62,14 +62,14 @@
<pre>{{node_html .Decl $.FSet}}</pre>
{{end}}
{{range .Factories}}
{{$name := html .Name}}
<h3 id="{{$tname}}.{{$name}}">func <a href="/{{posLink_url .Decl $.FSet}}">{{$name}}</a></h3>
{{$name_html := html .Name}}
<h3 id="{{$tname_html}}.{{$name_html}}">func <a href="/{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
<p><code>{{node_html .Decl $.FSet}}</code></p>
{{comment_html .Doc}}
{{end}}
{{range .Methods}}
{{$name := html .Name}}
<h3 id="{{$tname}}.{{$name}}">func ({{node_html .Recv $.FSet}}) <a href="/{{posLink_url .Decl $.FSet}}">{{$name}}</a></h3>
{{$name_html := html .Name}}
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{node_html .Recv $.FSet}}) <a href="/{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3>
<p><code>{{node_html .Decl $.FSet}}</code></p>
{{comment_html .Doc}}
{{end}}
......
......@@ -3,7 +3,7 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{$query := urlquery .Query}}
{{$query_url := urlquery .Query}}
{{with .Alert}}
<p>
<span class="alert" style="font-size:120%">{{html .}}</span>
......@@ -21,13 +21,13 @@
{{with .Decls}}
<h2 id="Global">Package-level declarations</h2>
{{range .}}
{{$pkg := pkgLink .Pak.Path | html}}
<h3 id="Global_{{$pkg}}">package <a href="/{{$pkg}}">{{html .Pak.Name}}</a></h3>
{{$pkg_html := pkgLink .Pak.Path | html}}
<h3 id="Global_{{$pkg_html}}">package <a href="/{{$pkg_html}}">{{html .Pak.Name}}</a></h3>
{{range .Files}}
{{$src := srcLink .File.Path | html}}
{{$src_html := srcLink .File.Path | html}}
{{range .Groups}}
{{range .Infos}}
<a href="/{{$src}}?h={{$query}}#L{{infoLine .}}">{{$src}}:{{infoLine .}}</a>
<a href="/{{$src_html}}?h={{$query_url}}#L{{infoLine .}}">{{$src_html}}:{{infoLine .}}</a>
{{infoSnippet_html .}}
{{end}}
{{end}}
......@@ -37,11 +37,11 @@
{{with .Others}}
<h2 id="Local">Local declarations and uses</h2>
{{range .}}
{{$pkg := pkgLink .Pak.Path | html}}
<h3 id="Local_{{$pkg}}">package <a href="/{{$pkg}}">{{html .Pak.Name}}</a></h3>
{{$pkg_html := pkgLink .Pak.Path | html}}
<h3 id="Local_{{$pkg_html}}">package <a href="/{{$pkg_html}}">{{html .Pak.Name}}</a></h3>
{{range .Files}}
{{$src := srcLink .File.Path | html}}
<a href="/{{$src}}?h={{$query}}">{{$src}}</a>
{{$src_html := srcLink .File.Path | html}}
<a href="/{{$src_html}}?h={{$query_url}}">{{$src_html}}</a>
<table class="layout">
{{range .Groups}}
<tr>
......@@ -50,7 +50,7 @@
<td align="left" width="4"></td>
<td>
{{range .Infos}}
<a href="/{{$src}}?h={{$query}}#L{{infoLine .}}">{{infoLine .}}</a>
<a href="/{{$src_html}}?h={{$query_url}}#L{{infoLine .}}">{{infoLine .}}</a>
{{end}}
</td>
</tr>
......@@ -72,17 +72,17 @@
<p>
<table class="layout">
{{range .}}
{{$src := srcLink .Filename | html}}
{{$src_html := srcLink .Filename | html}}
<tr>
<td align="left" valign="top">
<a href="/{{$src}}?h={{$query}}">{{$src}}</a>:
<a href="/{{$src_html}}?h={{$query_url}}">{{$src_html}}</a>:
</td>
<td align="left" width="4"></td>
<th align="left" valign="top">{{len .Lines}}</th>
<td align="left" width="4"></td>
<td align="left">
{{range .Lines}}
<a href="/{{$src}}?h={{$query}}#L{{html .}}">{{html .}}</a>
<a href="/{{$src_html}}?h={{$query_url}}#L{{html .}}">{{html .}}</a>
{{end}}
{{if not $.Complete}}
...
......
......@@ -17,7 +17,7 @@ DID YOU MEAN
PACKAGE-LEVEL DECLARATIONS
{{range .}}package {{.Pak.Name}}
{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $File.File.Path}}:{{infoLine .}}{{end}}
{{range $file := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $file.File.Path}}:{{infoLine .}}{{end}}
{{end}}{{end}}{{/* .Files */}}
{{end}}{{end}}{{/* .Decls */}}{{/*
......@@ -27,7 +27,7 @@ PACKAGE-LEVEL DECLARATIONS
LOCAL DECLARATIONS AND USES
{{range .}}package {{.Pak.Name}}
{{range $File := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $File.File.Path}}:{{infoLine .}}
{{range $file := .Files}}{{range .Groups}}{{range .Infos}} {{srcLink $file.File.Path}}:{{infoLine .}}
{{end}}{{end}}{{end}}{{/* .Files */}}
{{end}}{{end}}{{/* .Others */}}{{end}}{{/* .Hit */}}{{/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment