summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2013-03-11 13:38:59 -0700
committerRobert Griesemer <gri@golang.org>2013-03-11 13:38:59 -0700
commit8b00441f24970de4456d4d0cd2a287613d46163b (patch)
treea88fcf24dc89bb17ba33f37fbcb3b39186f2ae10 /lib
parent6d61cb7af9af1bb0915622d99d065d80fec61d12 (diff)
downloadgo-8b00441f24970de4456d4d0cd2a287613d46163b.tar.gz
cmd/godoc: only show package documentation for commands
Fixed package.txt and adjusted package.html to match structure (swapped if branches). Fixes issue 4861. R=golang-dev, adg, rsc CC=golang-dev https://codereview.appspot.com/7714043
Diffstat (limited to 'lib')
-rw-r--r--lib/godoc/package.html8
-rw-r--r--lib/godoc/package.txt11
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/godoc/package.html b/lib/godoc/package.html
index 1df1f9151..1fe6e7595 100644
--- a/lib/godoc/package.html
+++ b/lib/godoc/package.html
@@ -10,7 +10,11 @@
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>
@@ -160,8 +164,6 @@
{{example_html $name $.Examples $.FSet}}
{{end}}
{{end}}
- {{else}} {{/* not a package; is a command */}}
- {{comment_html .Doc}}
{{end}}
{{with $.Notes}}
diff --git a/lib/godoc/package.txt b/lib/godoc/package.txt
index 94239ca1a..de40a749b 100644
--- a/lib/godoc/package.txt
+++ b/lib/godoc/package.txt
@@ -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}}{{/*
---------------------------------------