diff options
author | Robert Griesemer <gri@golang.org> | 2013-03-26 18:28:16 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2013-03-26 18:28:16 -0700 |
commit | b8decf1b282c41f2bdf6877648dc1f1dd1ad1cf1 (patch) | |
tree | ae2ad503042389c163807f9fb6e2fa2920caa4eb /lib | |
parent | 32bd5db2dd2363f654f2a5da91336ba65c5a2591 (diff) | |
download | go-b8decf1b282c41f2bdf6877648dc1f1dd1ad1cf1.tar.gz |
godoc: pass *PageInfos instead of *token.FileSets in templates
- convert all formatters that require a *token.FileSet to
consistenly use a *PageInfo as first argument instead
- adjust templates correspondingly
- fix outstanding bug from previous CL 8005044
Going forward, with this change the affected functions have
access to the full page "context" (PageInfo), not just the
respective file set. This will permit better context-dependent
formatting in the future.
R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7860049
Diffstat (limited to 'lib')
-rw-r--r-- | lib/godoc/package.html | 42 | ||||
-rw-r--r-- | lib/godoc/package.txt | 28 |
2 files changed, 35 insertions, 35 deletions
diff --git a/lib/godoc/package.html b/lib/godoc/package.html index 33c2c2791..5dcc9f9a2 100644 --- a/lib/godoc/package.html +++ b/lib/godoc/package.html @@ -40,7 +40,7 @@ {{comment_html .Doc}} </div> </div> - {{example_html "" $.Examples $.FSet}} + {{example_html $ ""}} <div id="pkg-index" class="toggleVisible"> <div class="collapsed"> @@ -60,18 +60,18 @@ {{end}} {{range .Funcs}} {{$name_html := html .Name}} - <dd><a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd> + <dd><a href="#{{$name_html}}">{{node_html $ .Decl}}</a></dd> {{end}} {{range .Types}} {{$tname_html := html .Name}} <dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd> {{range .Funcs}} {{$name_html := html .Name}} - <dd> <a href="#{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd> + <dd> <a href="#{{$name_html}}">{{node_html $ .Decl}}</a></dd> {{end}} {{range .Methods}} {{$name_html := html .Name}} - <dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html .Decl $.FSet}}</a></dd> + <dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl}}</a></dd> {{end}} {{end}} {{if $.Notes}} @@ -109,59 +109,59 @@ {{with .Consts}} <h2 id="pkg-constants">Constants</h2> {{range .}} - <pre>{{node_html .Decl $.FSet}}</pre> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{end}} {{end}} {{with .Vars}} <h2 id="pkg-variables">Variables</h2> {{range .}} - <pre>{{node_html .Decl $.FSet}}</pre> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{end}} {{end}} {{range .Funcs}} {{/* Name is a string - no need for FSet */}} {{$name_html := html .Name}} - <h2 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h2> - <pre>{{node_html .Decl $.FSet}}</pre> + <h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h2> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} - {{example_html .Name $.Examples $.FSet}} + {{example_html $ .Name}} {{end}} {{range .Types}} {{$tname := .Name}} {{$tname_html := html .Name}} - <h2 id="{{$tname_html}}">type <a href="{{posLink_url .Decl $.FSet}}">{{$tname_html}}</a></h2> - <pre>{{node_html .Decl $.FSet}}</pre> + <h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a></h2> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{range .Consts}} - <pre>{{node_html .Decl $.FSet}}</pre> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{end}} {{range .Vars}} - <pre>{{node_html .Decl $.FSet}}</pre> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{end}} - {{example_html $tname $.Examples $.FSet}} + {{example_html $ $tname}} {{range .Funcs}} {{$name_html := html .Name}} - <h3 id="{{$name_html}}">func <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3> - <pre>{{node_html .Decl $.FSet}}</pre> + <h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} - {{example_html .Name $.Examples $.FSet}} + {{example_html $ .Name}} {{end}} {{range .Methods}} {{$name_html := html .Name}} - <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url .Decl $.FSet}}">{{$name_html}}</a></h3> - <pre>{{node_html .Decl $.FSet}}</pre> + <h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3> + <pre>{{node_html $ .Decl}}</pre> {{comment_html .Doc}} {{$name := printf "%s_%s" $tname .Name}} - {{example_html $name $.Examples $.FSet}} + {{example_html $ $name}} {{end}} {{end}} {{end}} @@ -179,7 +179,7 @@ {{end}} {{with .PAst}} - <pre>{{node_html . $.FSet}}</pre> + <pre>{{node_html $ .}}</pre> {{end}} {{with .Dirs}} diff --git a/lib/godoc/package.txt b/lib/godoc/package.txt index bc11fc3c5..407be5787 100644 --- a/lib/godoc/package.txt +++ b/lib/godoc/package.txt @@ -1,4 +1,4 @@ -{{with .PAst}}{{node . $.FSet}}{{end}}{{/* +{{with .PAst}}{{node $ .}}{{end}}{{/* --------------------------------------- @@ -11,14 +11,14 @@ package {{.Name}} import "{{.ImportPath}}" {{comment_text .Doc " " "\t"}} -{{example_text "" $.Examples $.FSet " "}}{{/* +{{example_text $ "" " "}}{{/* --------------------------------------- */}}{{with .Consts}} CONSTANTS -{{range .}}{{node .Decl $.FSet}} +{{range .}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}}{{end}} {{end}}{{/* @@ -27,7 +27,7 @@ CONSTANTS */}}{{with .Vars}} VARIABLES -{{range .}}{{node .Decl $.FSet}} +{{range .}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}}{{end}} {{end}}{{/* @@ -36,9 +36,9 @@ VARIABLES */}}{{with .Funcs}} FUNCTIONS -{{range .}}{{node .Decl $.FSet}} +{{range .}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{example_text .Name $.Examples $.FSet " "}} +{{example_text $ .Name " "}} {{end}}{{end}}{{/* --------------------------------------- @@ -46,19 +46,19 @@ FUNCTIONS */}}{{with .Types}} TYPES -{{range .}}{{$tname := .Name}}{{node .Decl $.FSet}} +{{range .}}{{$tname := .Name}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{range .Consts}}{{node .Decl $.FSet}} +{{range .Consts}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{end}}{{range .Vars}}{{node .Decl $.FSet}} +{{end}}{{range .Vars}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{end}}{{example_text .Name $.Examples $.FSet " "}} -{{range .Funcs}}{{node .Decl $.FSet}} +{{end}}{{example_text $ .Name " "}} +{{range .Funcs}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{example_text .Name $.Examples $.FSet " "}} -{{end}}{{range .Methods}}{{node .Decl $.FSet}} +{{example_text $ .Name " "}} +{{end}}{{range .Methods}}{{node $ .Decl}} {{comment_text .Doc " " "\t"}} -{{$name := printf "%s_%s" $tname .Name}}{{example_text $name $.Examples $.FSet " "}} +{{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}} {{end}}{{end}}{{end}}{{end}}{{/* --------------------------------------- |