]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/godoc: only show package documentation for commands
authorRobert Griesemer <gri@golang.org>
Mon, 11 Mar 2013 20:38:59 +0000 (13:38 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 11 Mar 2013 20:38:59 +0000 (13:38 -0700)
Fixed package.txt and adjusted package.html to match
structure (swapped if branches).

Fixes #4861.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7714043

lib/godoc/package.html
lib/godoc/package.txt

index 1df1f9151dfd5b25c9b1f09c3201decbf6557cf9..1fe6e7595fd8e0452a048ca61c65e1e1c1f5a04a 100644 (file)
        correspond to Go identifiers).
 -->
 {{with .PDoc}}
-       {{if not $.IsMain}}
+       {{if $.IsMain}}
+               {{/* command documentation */}}
+               {{comment_html .Doc}}
+       {{else}}
+               {{/* package documentation */}}
                <div id="short-nav">
                        <dl>
                        <dd><code>import "{{html .ImportPath}}"</code></dd>
                                {{example_html $name $.Examples $.FSet}}
                        {{end}}
                {{end}}
-       {{else}}  {{/* not a package; is a command */}}
-               {{comment_html .Doc}}
        {{end}}
 
        {{with $.Notes}}
index 94239ca1a5466dab87de34da932e97b99a62c4eb..de40a749b6b6e73c503a5f0af9dc0238ad8836d9 100644 (file)
@@ -2,14 +2,15 @@
 
 ---------------------------------------
 
-*/}}{{with .PDoc}}{{if not $.IsMain}}PACKAGE
+*/}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION
+
+{{comment_text .Doc "    " "\t"}}
+{{else}}PACKAGE DOCUMENTATION
 
 package {{.Name}}
     import "{{.ImportPath}}"
 
-{{else}}COMMAND DOCUMENTATION
-
-{{end}}{{comment_text .Doc "    " "\t"}}
+{{comment_text .Doc "    " "\t"}}
 {{example_text "" $.Examples $.FSet "    "}}{{/*
 
 ---------------------------------------
@@ -58,7 +59,7 @@ TYPES
 {{end}}{{range .Methods}}{{node .Decl $.FSet}}
 {{comment_text .Doc "    " "\t"}}
 {{$name := printf "%s_%s" $tname .Name}}{{example_text $name $.Examples $.FSet "    "}}
-{{end}}{{end}}{{end}}{{/*
+{{end}}{{end}}{{end}}{{end}}{{/*
 
 ---------------------------------------