From 508186a7653be66b05ea9a5820a14ab55f93875c Mon Sep 17 00:00:00 2001
From: Andrew Gerrand
+
+{{range .}}
+
diff --git a/cmd/godoc/template/dirlist.html b/cmd/godoc/template/dirlist.html
new file mode 100644
index 00000000..a3e1a2fa
--- /dev/null
+++ b/cmd/godoc/template/dirlist.html
@@ -0,0 +1,31 @@
+
+
+
+ {{$name_html := html .Name}}
+
+{{end}}
+{{$name_html}}
+
+ {{html .Title}}
+
+
+
+
+File
+
+ Bytes
+
+ Modified
+
+
+{{range .}}
+..
+
+ {{$name_html := fileInfoName . | html}}
+
+{{end}}
+
+{{$name_html}}
+
+ {{html .Size}}
+
+ {{fileInfoTime . | html}}
+
+{{html .}} +
diff --git a/cmd/godoc/template/example.html b/cmd/godoc/template/example.html new file mode 100644 index 00000000..cda2a849 --- /dev/null +++ b/cmd/godoc/template/example.html @@ -0,0 +1,28 @@ +▹ Example{{example_suffix .Name}}
+{{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{end}}
+ {{end}}
+ {{with .Vars}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{end}}
+ {{end}}
+ {{range .Funcs}}
+ {{/* Name is a string - no need for FSet */}}
+ {{$name_html := html .Name}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{example_html $ .Name}}
+ {{end}}
+ {{range .Types}}
+ {{$tname := .Name}}
+ {{$tname_html := html .Name}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+
+ {{range .Consts}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{end}}
+
+ {{range .Vars}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{end}}
+
+ {{example_html $ $tname}}
+
+ {{range .Funcs}}
+ {{$name_html := html .Name}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{example_html $ .Name}}
+ {{end}}
+
+ {{range .Methods}}
+ {{$name_html := html .Name}}
+ {{node_html $ .Decl true}}
+ {{comment_html .Doc}}
+ {{$name := printf "%s_%s" $tname .Name}}
+ {{example_html $ $name}}
+ {{end}}
+ {{end}}
+ {{end}}
+
+ {{with $.Notes}}
+ {{range $marker, $content := .}}
+ {{node_html $ . false}}
+{{end}}
+
+{{with .Dirs}}
+ {{/* DirList entries are numbers and strings - no need for FSet */}}
+ {{if $.PDoc}}
+
+ | Name | ++ | Synopsis | +
|---|---|---|
| .. | +||
| {{html .Path}} | ++ | {{html .Synopsis}} | +
| {{repeat ` ` .Depth}}{{html .Name}} | ++ | {{html .Synopsis}} | +
Need more packages? Take a look at the Go Projects wiki page.
+ {{end}} +{{end}} diff --git a/cmd/godoc/template/package.txt b/cmd/godoc/template/package.txt new file mode 100644 index 00000000..d191621c --- /dev/null +++ b/cmd/godoc/template/package.txt @@ -0,0 +1,80 @@ +{{with .PAst}}{{node $ .}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION + +{{comment_text .Doc " " "\t"}} +{{else}}PACKAGE DOCUMENTATION + +package {{.Name}} + import "{{.ImportPath}}" + +{{comment_text .Doc " " "\t"}} +{{example_text $ "" " "}}{{/* + +--------------------------------------- + +*/}}{{with .Consts}} +CONSTANTS + +{{range .}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{end}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with .Vars}} +VARIABLES + +{{range .}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{end}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with .Funcs}} +FUNCTIONS + +{{range .}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{example_text $ .Name " "}}{{end}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with .Types}} +TYPES + +{{range .}}{{$tname := .Name}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{range .Consts}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{end}}{{range .Vars}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{end}}{{example_text $ .Name " "}} +{{range .Funcs}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{example_text $ .Name " "}} +{{end}}{{range .Methods}}{{node $ .Decl}} +{{comment_text .Doc " " "\t"}} +{{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}}{{end}} +{{end}}{{end}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with $.Notes}} +{{range $marker, $content := .}} +{{$marker}}S + +{{range $content}}{{comment_text .Body " " "\t"}} +{{end}}{{end}}{{end}}{{end}}{{/* + +--------------------------------------- + +*/}}{{with .Dirs}} +SUBDIRECTORIES +{{if $.DirFlat}}{{range .List}}{{if .HasPkg}} + {{.Path}}{{end}}{{end}} +{{else}}{{range .List}} + {{repeat `. ` .Depth}}{{.Name}}{{end}} +{{end}}{{end}} diff --git a/cmd/godoc/template/search.html b/cmd/godoc/template/search.html new file mode 100644 index 00000000..5b54d712 --- /dev/null +++ b/cmd/godoc/template/search.html @@ -0,0 +1,109 @@ + +{{$query_url := urlquery .Query}} +{{with .Alert}} ++ {{html .}} +
+{{end}} +{{with .Alt}} ++ Did you mean: + {{range .Alts}} + {{html .}} + {{end}} +
+{{end}} +{{with .Pak}} ++
| {{$pkg_html}} |
| + | {{index . 0 | infoKind_html}} | ++ | + {{range .}} + {{infoLine .}} + {{end}} + | +
|---|
+ Not all files or lines containing "{{html $.Query}}" are shown. +
+ {{end}} ++
| + {{$src_html}}: + | ++ | {{len .Lines}} | ++ | + {{range .Lines}} + {{html .}} + {{end}} + {{if not $.Complete}} + ... + {{end}} + | +
|---|---|---|---|---|
| ... |
+ {{end}} + {{.XML}} +