From 71b1c6d3c98b0f34070be4c8f5e9d4c0cb2731ac Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 26 Jan 2012 13:02:03 -0500 Subject: [PATCH] godoc: move overview before API TOC Compare: http://swtch.com/junk/regexp0.html [old] http://swtch.com/junk/regexp.html [new] Especially for packages with large APIs, this makes the overview more promiment, so that it can give the appropriate context for reading the API list. This should help significantly in packages with large APIs, like net, so that the first thing users see is not a jumble of functions but an introduction to the package. R=adg, gri, r, kevlar, dsymonds, rogpeppe CC=golang-dev https://golang.org/cl/5573068 --- lib/godoc/package.html | 203 +++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 97 deletions(-) diff --git a/lib/godoc/package.html b/lib/godoc/package.html index 4aa77be88e..c7a01a877e 100644 --- a/lib/godoc/package.html +++ b/lib/godoc/package.html @@ -3,118 +3,121 @@ Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> -{{if .IsPkg}} - -
{{with .PDoc}} -
-
Overview
- {{if .Consts}} -
Constants
- {{end}} - {{if .Vars}} -
Variables
- {{end}} - {{range .Funcs}} - {{$name_html := html .Name}} -
{{node_html .Decl $.FSet}}
- {{end}} - {{range .Types}} - {{$tname_html := html .Name}} -
type {{$tname_html}}
- {{range .Funcs}} - {{$name_html := html .Name}} -
    {{node_html .Decl $.FSet}}
- {{end}} - {{range .Methods}} - {{$name_html := html .Name}} -
    {{node_html .Decl $.FSet}}
- {{end}} - {{end}} - {{if .Bugs}} -
Bugs
- {{end}} -
-{{end}} -
-{{end}} - - -{{with .PAst}} -
{{node_html . $.FSet}}
-{{end}} -{{with .PDoc}} -

Overview

- - {{if $.IsPkg}} -

import "{{html .ImportPath}}"

- {{end}} - {{comment_html .Doc}} {{if $.IsPkg}} - {{with .Filenames}} -

Package files

-

- +

+
+
import "{{html .ImportPath}}"
+
+
+
Overview
+
Index
+
+
+

Overview

+ + {{comment_html .Doc}} + +

Index

+ +
+
+ {{if .Consts}} +
Constants
+ {{end}} + {{if .Vars}} +
Variables
+ {{end}} + {{range .Funcs}} + {{$name_html := html .Name}} +
{{node_html .Decl $.FSet}}
+ {{end}} + {{range .Types}} + {{$tname_html := html .Name}} +
type {{$tname_html}}
+ {{range .Funcs}} + {{$name_html := html .Name}} +
    {{node_html .Decl $.FSet}}
+ {{end}} + {{range .Methods}} + {{$name_html := html .Name}} +
    {{node_html .Decl $.FSet}}
+ {{end}} + {{end}} + {{if .Bugs}} +
Bugs
+ {{end}} +
+ {{with .Filenames}} +

Package files

+

+ + {{range .}} + {{.|filename|html}} + {{end}} + +

+ {{end}} +
+
+ + {{with .Consts}} +

Constants

{{range .}} - {{.|filename|html}} + {{comment_html .Doc}} +
{{node_html .Decl $.FSet}}
{{end}} - -

- {{end}} - {{end}} - {{with .Consts}} -

Constants

- {{range .}} - {{comment_html .Doc}} -
{{node_html .Decl $.FSet}}
{{end}} - {{end}} - {{with .Vars}} -

Variables

- {{range .}} - {{comment_html .Doc}} -
{{node_html .Decl $.FSet}}
- {{end}} - {{end}} - {{range .Funcs}} - {{/* Name is a string - no need for FSet */}} - {{$name_html := html .Name}} -

func {{$name_html}}

-

{{node_html .Decl $.FSet}}

- {{comment_html .Doc}} - {{example_html .Name $.Examples $.FSet}} - {{end}} - {{range .Types}} - {{$tname := .Name}} - {{$tname_html := html .Name}} -

type {{$tname_html}}

- {{comment_html .Doc}} -
{{node_html .Decl $.FSet}}
- {{range .Consts}} - {{comment_html .Doc}} -
{{node_html .Decl $.FSet}}
- {{end}} - {{range .Vars}} - {{comment_html .Doc}} -
{{node_html .Decl $.FSet}}
+ {{with .Vars}} +

Variables

+ {{range .}} + {{comment_html .Doc}} +
{{node_html .Decl $.FSet}}
+ {{end}} {{end}} - {{example_html $tname $.Examples $.FSet}} {{range .Funcs}} + {{/* Name is a string - no need for FSet */}} {{$name_html := html .Name}} -

func {{$name_html}}

+

func {{$name_html}}

{{node_html .Decl $.FSet}}

{{comment_html .Doc}} {{example_html .Name $.Examples $.FSet}} {{end}} - {{range .Methods}} - {{$name_html := html .Name}} -

func ({{html .Recv}}) {{$name_html}}

-

{{node_html .Decl $.FSet}}

+ {{range .Types}} + {{$tname := .Name}} + {{$tname_html := html .Name}} +

type {{$tname_html}}

{{comment_html .Doc}} - {{$name := printf "%s_%s" $tname .Name}} - {{example_html $name $.Examples $.FSet}} +
{{node_html .Decl $.FSet}}
+ {{range .Consts}} + {{comment_html .Doc}} +
{{node_html .Decl $.FSet}}
+ {{end}} + {{range .Vars}} + {{comment_html .Doc}} +
{{node_html .Decl $.FSet}}
+ {{end}} + {{example_html $tname $.Examples $.FSet}} + {{range .Funcs}} + {{$name_html := html .Name}} +

func {{$name_html}}

+

{{node_html .Decl $.FSet}}

+ {{comment_html .Doc}} + {{example_html .Name $.Examples $.FSet}} + {{end}} + {{range .Methods}} + {{$name_html := html .Name}} +

func ({{html .Recv}}) {{$name_html}}

+

{{node_html .Decl $.FSet}}

+ {{comment_html .Doc}} + {{$name := printf "%s_%s" $tname .Name}} + {{example_html $name $.Examples $.FSet}} + {{end}} {{end}} + {{else}} {{/* not a package; is a command */}} + {{comment_html .Doc}} {{end}} + {{with .Bugs}}

Bugs

{{range .}} @@ -122,6 +125,11 @@ {{end}} {{end}} {{end}} + +{{with .PAst}} +
{{node_html . $.FSet}}
+{{end}} + {{with .PList}}

Other packages

@@ -131,6 +139,7 @@ {{end}}

{{end}} + {{with .Dirs}} {{/* DirList entries are numbers and strings - no need for FSet */}}

Subdirectories

-- 2.50.0