internal/godoc: remove unused configuration

There is lots of dead flexibility in this code.
Remove it, to make the control flow and data dependencies
easier to understand.

Change-Id: Ie9aa7bc96afc64d2a07677a73f8fb311808ef307
Reviewed-on: https://go-review.googlesource.com/c/website/+/296377
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/_content/lib/godoc/godoc.html b/_content/lib/godoc/godoc.html
index c50b8b3..f1d14e4 100644
--- a/_content/lib/godoc/godoc.html
+++ b/_content/lib/godoc/godoc.html
@@ -28,9 +28,7 @@
 {{end}}
 <script src="/lib/godoc/jquery.js" defer></script>
 
-{{if .Playground}}
 <script src="/lib/godoc/playground.js" defer></script>
-{{end}}
 {{with .Version}}<script>var goVersion = {{printf "%q" .}};</script>{{end}}
 <script src="/lib/godoc/godocs.js" defer></script>
 
@@ -54,9 +52,7 @@
       <li class="Header-menuItem"><a href="/help/">Help</a></li>
       {{if not .GoogleCN}}
         <li class="Header-menuItem"><a href="/blog/">Blog</a></li>
-        {{if .Playground}}
-          <li class="Header-menuItem"><a href="https://play.golang.org/">Play</a></li>
-        {{end}}
+        <li class="Header-menuItem"><a href="https://play.golang.org/">Play</a></li>
       {{end}}
     </ul>
   </nav>
diff --git a/_content/lib/godoc/package.html b/_content/lib/godoc/package.html
index 1213db4..1e36fff 100644
--- a/_content/lib/godoc/package.html
+++ b/_content/lib/godoc/package.html
@@ -74,10 +74,8 @@
 					<dd>&nbsp; &nbsp; <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false | sanitize}}</a></dd>
 				{{end}}
 			{{end}}
-			{{if $.Notes}}
-				{{range $marker, $item := $.Notes}}
-				<dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd>
-				{{end}}
+			{{if $.Bugs}}
+				<dd><a href="#pkg-note-BUG">Bugs</a></dd>
 			{{end}}
 			</dl>
 			</div><!-- #manual-nav -->
@@ -184,15 +182,13 @@
 		{{end}}
 	{{end}}
 
-	{{with $.Notes}}
-		{{range $marker, $content := .}}
-			<h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2>
-			<ul style="list-style: none; padding: 0;">
-			{{range .}}
-			<li><a href="{{posLink_url $ .}}" style="float: left;">&#x261e;</a> {{comment_html .Body}}</li>
-			{{end}}
-			</ul>
+	{{with $.Bugs}}
+		<h2 id="pkg-note-BUG">Bugs</h2>
+		<ul style="list-style: none; padding: 0;">
+		{{range .}}
+		<li><a href="{{posLink_url $ .}}" style="float: left;">&#x261e;</a> {{comment_html .Body}}</li>
 		{{end}}
+		</ul>
 	{{end}}
 {{end}}
 
diff --git a/_content/lib/godoc/packageroot.html b/_content/lib/godoc/packageroot.html
index c7caaba..8655dcd 100644
--- a/_content/lib/godoc/packageroot.html
+++ b/_content/lib/godoc/packageroot.html
@@ -23,9 +23,6 @@
 		<div id="manual-nav">
 			<dl>
 				<dt><a href="#stdlib">Standard library</a></dt>
-				{{if hasThirdParty .List }}
-					<dt><a href="#thirdparty">Third party</a></dt>
-				{{end}}
 				<dt><a href="#other">Other packages</a></dt>
 				<dd><a href="#subrepo">Sub-repositories</a></dd>
 				<dd><a href="#community">Community</a></dd>
@@ -71,46 +68,6 @@
 			</div> <!-- .expanded -->
 		</div> <!-- #stdlib .toggleVisible -->
 
-	{{if hasThirdParty .List }}
-		<div id="thirdparty" class="toggleVisible">
-			<div class="collapsed">
-				<h2 class="toggleButton" title="Click to show Third party section">Third party ▹</h2>
-			</div>
-			<div class="expanded">
-				<h2 class="toggleButton" title="Click to hide Third party section">Third party ▾</h2>
-				<div class="pkg-dir">
-					<table>
-						<tr>
-							<th class="pkg-name">Name</th>
-							<th class="pkg-synopsis">Synopsis</th>
-						</tr>
-
-						{{range .List}}
-							<tr>
-								{{if eq .RootType "GOPATH"}}
-								{{if $.DirFlat}}
-									{{if .HasPkg}}
-											<td class="pkg-name">
-												<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Path}}</a>
-											</td>
-									{{end}}
-								{{else}}
-										<td class="pkg-name" style="padding-left: {{multiply .Depth 20}}px;">
-											<a href="{{html .Path}}/{{modeQueryString $.Mode | html}}">{{html .Name}}</a>
-										</td>
-								{{end}}
-									<td class="pkg-synopsis">
-										{{html .Synopsis}}
-									</td>
-								{{end}}
-							</tr>
-						{{end}}
-					</table>
-				</div> <!-- .pkg-dir -->
-			</div> <!-- .expanded -->
-		</div> <!-- #stdlib .toggleVisible -->
-	{{end}}
-
 	<h2 id="other">Other packages</h2>
 	<h3 id="subrepo">Sub-repositories</h3>
 	<p>
diff --git a/cmd/golangorg/doc.go b/cmd/golangorg/doc.go
deleted file mode 100644
index 64d8c31..0000000
--- a/cmd/golangorg/doc.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-
-Godoc extracts and generates documentation for Go programs.
-
-It runs as a web server and presents the documentation as a
-web page.
-
-	godoc -http=:6060
-
-Usage:
-
-	godoc [flag]
-
-The flags are:
-
-	-v
-		verbose mode
-	-timestamps=true
-		show timestamps with directory listings
-	-play=false
-		enable playground
-	-links=true
-		link identifiers to their declarations
-	-notes="BUG"
-		regular expression matching note markers to show
-		(e.g., "BUG|TODO", ".*")
-	-goroot=$GOROOT
-		Go root directory
-	-http=addr
-		HTTP service address (e.g., '127.0.0.1:6060' or just ':6060')
-	-templates=""
-		directory containing alternate template files; if set,
-		the directory may provide alternative template files
-		for the files in _content/
-
-By default, golangorg looks at the packages it finds via $GOROOT (if set).
-This behavior can be altered by providing an alternative $GOROOT with the -goroot
-flag.
-
-By default, godoc uses the system's GOOS/GOARCH. You can provide the URL parameters
-"GOOS" and "GOARCH" to set the output on the web page for the target system.
-
-The presentation mode of web pages served by godoc can be controlled with the
-"m" URL parameter; it accepts a comma-separated list of flag names as value:
-
-	all	show documentation for all declarations, not just the exported ones
-	methods	show all embedded methods, not just those of unexported anonymous fields
-	src	show the original source code rather than the extracted documentation
-	flat	present flat (not indented) directory listings using full paths
-
-For instance, https://golang.org/pkg/math/big/?m=all shows the documentation
-for all (not just the exported) declarations of package big.
-
-Godoc serves files from the file system of the underlying OS.
-
-Godoc documentation is converted to HTML or to text using the go/doc package;
-see https://golang.org/pkg/go/doc/#ToHTML for the exact rules.
-Godoc also shows example code that is runnable by the testing package;
-see https://golang.org/pkg/testing/#hdr-Examples for the conventions.
-See "Godoc: documenting Go code" for how to write good comments for godoc:
-https://golang.org/doc/articles/godoc_documenting_go_code.html
-
-*/
-package main // import "golang.org/x/website/cmd/golangorg"
diff --git a/cmd/golangorg/main.go b/cmd/golangorg/main.go
index 3f102b7..03f42a2 100644
--- a/cmd/golangorg/main.go
+++ b/cmd/golangorg/main.go
@@ -27,7 +27,6 @@
 	"log"
 	"net/http"
 	"os"
-	"regexp"
 	"runtime"
 
 	"golang.org/x/website"
@@ -35,14 +34,10 @@
 )
 
 var (
-	httpAddr       = flag.String("http", "localhost:6060", "HTTP service address")
-	verbose        = flag.Bool("v", false, "verbose mode")
-	goroot         = flag.String("goroot", runtime.GOROOT(), "Go root directory")
-	showTimestamps = flag.Bool("timestamps", false, "show timestamps with directory listings")
-	templateDir    = flag.String("templates", "", "load templates/JS/CSS from disk in this directory (usually /path-to-website/content)")
-	showPlayground = flag.Bool("play", true, "enable playground")
-	declLinks      = flag.Bool("links", true, "link identifiers to their declarations")
-	notesRx        = flag.String("notes", "BUG", "regular expression matching note markers to show")
+	httpAddr    = flag.String("http", "localhost:6060", "HTTP service address")
+	verbose     = flag.Bool("v", false, "verbose mode")
+	goroot      = flag.String("goroot", runtime.GOROOT(), "Go root directory")
+	templateDir = flag.String("templates", "", "load templates/JS/CSS from disk in this directory (usually /path-to-website/content)")
 )
 
 func usage() {
@@ -93,12 +88,6 @@
 	corpus.InitVersionInfo()
 
 	pres = godoc.NewPresentation(corpus)
-	pres.ShowTimestamps = *showTimestamps
-	pres.ShowPlayground = *showPlayground
-	pres.DeclLinks = *declLinks
-	if *notesRx != "" {
-		pres.NotesRx = regexp.MustCompile(*notesRx)
-	}
 	pres.GoogleCN = googleCN
 
 	readTemplates(pres)
diff --git a/internal/godoc/astfuncs.go b/internal/godoc/astfuncs.go
index 71398a9..9788d98 100644
--- a/internal/godoc/astfuncs.go
+++ b/internal/godoc/astfuncs.go
@@ -36,7 +36,7 @@
 
 	var buf2 bytes.Buffer
 	var n ast.Node
-	if linkify && p.DeclLinks {
+	if linkify {
 		n, _ = node.(ast.Node)
 	}
 	buf2.Write(texthtml.Format(buf1.Bytes(), texthtml.Config{
@@ -46,6 +46,8 @@
 	return buf2.String()
 }
 
+const TabWidth = 4
+
 // writeNode writes the AST node x to w.
 //
 // The provided fset must be non-nil. The pageInfo is optional. If
@@ -82,7 +84,7 @@
 	}
 
 	mode := printer.TabIndent | printer.UseSpaces
-	err := (&printer.Config{Mode: mode, Tabwidth: p.TabWidth}).Fprint(TabSpacer(out, p.TabWidth), fset, x)
+	err := (&printer.Config{Mode: mode, Tabwidth: TabWidth}).Fprint(TabSpacer(out, TabWidth), fset, x)
 	if err != nil {
 		log.Print(err)
 	}
diff --git a/internal/godoc/dirtrees.go b/internal/godoc/dirtrees.go
index 5c0897c..f7adf99 100644
--- a/internal/godoc/dirtrees.go
+++ b/internal/godoc/dirtrees.go
@@ -335,12 +335,6 @@
 	List      []DirEntry
 }
 
-// hasThirdParty checks whether a list of directory entries has packages outside
-// the standard library or not.
-func hasThirdParty(list []DirEntry) bool {
-	return false
-}
-
 // listing creates a (linear) directory listing from a directory tree.
 // If skipRoot is set, the root directory itself is excluded from the list.
 // If filter is set, only the directory entries whose paths match the filter
diff --git a/internal/godoc/examplefuncs.go b/internal/godoc/examplefuncs.go
index a1048bb..127bd17 100644
--- a/internal/godoc/examplefuncs.go
+++ b/internal/godoc/examplefuncs.go
@@ -40,7 +40,7 @@
 			// remove surrounding braces
 			code = code[1 : n-1]
 			// unindent
-			code = replaceLeadingIndentation(code, strings.Repeat(" ", p.TabWidth), "")
+			code = replaceLeadingIndentation(code, strings.Repeat(" ", TabWidth), "")
 			// remove output comment
 			if loc := exampleOutputRx.FindStringIndex(code); loc != nil {
 				code = strings.TrimSpace(code[:loc[0]])
@@ -50,7 +50,7 @@
 		// Write out the playground code in standard Go style
 		// (use tabs, no comment highlight, etc).
 		play := ""
-		if eg.Play != nil && p.ShowPlayground {
+		if eg.Play != nil {
 			var buf bytes.Buffer
 			eg.Play.Comments = filterOutBuildAnnotations(eg.Play.Comments)
 			if err := format.Node(&buf, info.FSet, eg.Play); err != nil {
diff --git a/internal/godoc/godoc.go b/internal/godoc/godoc.go
index 130baaf..25c3cd7 100644
--- a/internal/godoc/godoc.go
+++ b/internal/godoc/godoc.go
@@ -62,7 +62,7 @@
 		// support for URL attributes
 		"pkgLink":       pkgLinkFunc,
 		"srcLink":       srcLinkFunc,
-		"posLink_url":   newPosLink_urlFunc(srcPosLinkFunc),
+		"posLink_url":   posLink_urlFunc,
 		"docLink":       docLinkFunc,
 		"queryLink":     queryLinkFunc,
 		"srcBreadcrumb": srcBreadcrumbFunc,
@@ -73,26 +73,11 @@
 		"example_name":   p.example_nameFunc,
 		"example_suffix": p.example_suffixFunc,
 
-		// formatting of Notes
-		"noteTitle": noteTitle,
-
 		// Number operation
 		"multiply": multiply,
 
 		// formatting of PageInfoMode query string
 		"modeQueryString": modeQueryString,
-
-		// check whether to display third party section or not
-		"hasThirdParty": hasThirdParty,
-	}
-	if p.URLForSrc != nil {
-		p.funcMap["srcLink"] = p.URLForSrc
-	}
-	if p.URLForSrcPos != nil {
-		p.funcMap["posLink_url"] = newPosLink_urlFunc(p.URLForSrcPos)
-	}
-	if p.URLForSrcQuery != nil {
-		p.funcMap["queryLink"] = p.URLForSrcQuery
 	}
 }
 
@@ -111,13 +96,13 @@
 	Mode PageInfoMode // display metadata from query string
 
 	// package info
-	FSet       *token.FileSet         // nil if no package documentation
-	PDoc       *doc.Package           // nil if no package documentation
-	Examples   []*doc.Example         // nil if no example code
-	Notes      map[string][]*doc.Note // nil if no package Notes
-	PAst       map[string]*ast.File   // nil if no AST with package exports
-	IsMain     bool                   // true for package main
-	IsFiltered bool                   // true if results were filtered
+	FSet       *token.FileSet       // nil if no package documentation
+	PDoc       *doc.Package         // nil if no package documentation
+	Examples   []*doc.Example       // nil if no example code
+	Bugs       []*doc.Note          // nil if no BUG comments
+	PAst       map[string]*ast.File // nil if no AST with package exports
+	IsMain     bool                 // true for package main
+	IsFiltered bool                 // true if results were filtered
 
 	// directory info
 	Dirs    *DirList  // nil if no directory information
@@ -180,38 +165,36 @@
 	return buf.String()
 }
 
-func newPosLink_urlFunc(srcPosLinkFunc func(s string, line, low, high int) string) func(info *PageInfo, n interface{}) string {
+func posLink_urlFunc(info *PageInfo, n interface{}) string {
 	// n must be an ast.Node or a *doc.Note
-	return func(info *PageInfo, n interface{}) string {
-		var pos, end token.Pos
+	var pos, end token.Pos
 
-		switch n := n.(type) {
-		case ast.Node:
-			pos = n.Pos()
-			end = n.End()
-		case *doc.Note:
-			pos = n.Pos
-			end = n.End
-		default:
-			panic(fmt.Sprintf("wrong type for posLink_url template formatter: %T", n))
-		}
-
-		var relpath string
-		var line int
-		var low, high int // selection offset range
-
-		if pos.IsValid() {
-			p := info.FSet.Position(pos)
-			relpath = p.Filename
-			line = p.Line
-			low = p.Offset
-		}
-		if end.IsValid() {
-			high = info.FSet.Position(end).Offset
-		}
-
-		return srcPosLinkFunc(relpath, line, low, high)
+	switch n := n.(type) {
+	case ast.Node:
+		pos = n.Pos()
+		end = n.End()
+	case *doc.Note:
+		pos = n.Pos
+		end = n.End
+	default:
+		panic(fmt.Sprintf("wrong type for posLink_url template formatter: %T", n))
 	}
+
+	var relpath string
+	var line int
+	var low, high int // selection offset range
+
+	if pos.IsValid() {
+		p := info.FSet.Position(pos)
+		relpath = p.Filename
+		line = p.Line
+		low = p.Offset
+	}
+	if end.IsValid() {
+		high = info.FSet.Position(end).Offset
+	}
+
+	return srcPosLinkFunc(relpath, line, low, high)
 }
 
 func srcPosLinkFunc(s string, line, low, high int) string {
@@ -260,7 +243,3 @@
 func docLinkFunc(s string, ident string) string {
 	return pathpkg.Clean("/pkg/"+s) + "/#" + ident
 }
-
-func noteTitle(note string) string {
-	return strings.Title(strings.ToLower(note))
-}
diff --git a/internal/godoc/godoc_test.go b/internal/godoc/godoc_test.go
index 69914cb..d4c21cb 100644
--- a/internal/godoc/godoc_test.go
+++ b/internal/godoc/godoc_test.go
@@ -145,16 +145,16 @@
 }
 `))
 	want := `type T struct {
-<span id="T.NoDoc"></span>NoDoc <a href="/pkg/builtin/#string">string</a>
+<span id="T.NoDoc"></span>    NoDoc <a href="/pkg/builtin/#string">string</a>
 
-<span id="T.Doc"></span><span class="comment">// Doc has a comment.</span>
-Doc <a href="/pkg/builtin/#string">string</a>
+<span id="T.Doc"></span>    <span class="comment">// Doc has a comment.</span>
+    Doc <a href="/pkg/builtin/#string">string</a>
 
-<span id="T.Opt"></span><span class="comment">// Opt, if non-nil, is an option.</span>
-Opt *<a href="/pkg/builtin/#int">int</a>
+<span id="T.Opt"></span>    <span class="comment">// Opt, if non-nil, is an option.</span>
+    Opt *<a href="/pkg/builtin/#int">int</a>
 
-<span id="T.Опция"></span><span class="comment">// Опция - другое поле.</span>
-Опция <a href="/pkg/builtin/#bool">bool</a>
+<span id="T.Опция"></span>    <span class="comment">// Опция - другое поле.</span>
+    Опция <a href="/pkg/builtin/#bool">bool</a>
 }`
 	if got != want {
 		t.Errorf("got: %s\n\nwant: %s\n", got, want)
@@ -176,12 +176,12 @@
 	NoVal
 )`))
 	want := `const (
-<span id="NoDoc">NoDoc</span> <a href="/pkg/builtin/#string">string</a> = &#34;NoDoc&#34;
+    <span id="NoDoc">NoDoc</span> <a href="/pkg/builtin/#string">string</a> = &#34;NoDoc&#34;
 
-<span class="comment">// Doc has a comment</span>
-<span id="Doc">Doc</span> = &#34;Doc&#34;
+    <span class="comment">// Doc has a comment</span>
+    <span id="Doc">Doc</span> = &#34;Doc&#34;
 
-<span id="NoVal">NoVal</span>
+    <span id="NoVal">NoVal</span>
 )`
 	if got != want {
 		t.Errorf("got: %s\n\nwant: %s\n", got, want)
@@ -198,7 +198,7 @@
 
 var S T = T{X: 12}`))
 	want := `type T struct {
-<span id="T.X"></span>X <a href="/pkg/builtin/#int">int</a>
+<span id="T.X"></span>    X <a href="/pkg/builtin/#int">int</a>
 }
 var <span id="S">S</span> <a href="#T">T</a> = <a href="#T">T</a>{<a href="#T.X">X</a>: 12}`
 	if got != want {
@@ -229,9 +229,7 @@
 }
 
 func linkifySource(t *testing.T, src []byte) string {
-	p := &Presentation{
-		DeclLinks: true,
-	}
+	p := &Presentation{}
 	fset := token.NewFileSet()
 	af, err := parser.ParseFile(fset, "foo.go", src, parser.ParseComments)
 	if err != nil {
diff --git a/internal/godoc/page.go b/internal/godoc/page.go
index c9f063b..6c06ba5 100644
--- a/internal/godoc/page.go
+++ b/internal/godoc/page.go
@@ -25,7 +25,6 @@
 	GoogleCN bool // page is being served from golang.google.cn
 
 	// filled in by ServePage
-	Playground      bool
 	Version         string
 	GoogleAnalytics string
 }
@@ -34,7 +33,6 @@
 	if page.Tabtitle == "" {
 		page.Tabtitle = page.Title
 	}
-	page.Playground = p.ShowPlayground
 	page.Version = runtime.Version()
 	page.GoogleAnalytics = p.GoogleAnalytics
 	applyTemplateToResponseWriter(w, p.GodocHTML, page)
diff --git a/internal/godoc/pres.go b/internal/godoc/pres.go
index 3403e21..688400b 100644
--- a/internal/godoc/pres.go
+++ b/internal/godoc/pres.go
@@ -9,7 +9,6 @@
 
 import (
 	"net/http"
-	"regexp"
 	"sync"
 	"text/template"
 )
@@ -30,44 +29,6 @@
 	PackageHTML,
 	PackageRootHTML *template.Template
 
-	// TabWidth optionally specifies the tab width.
-	TabWidth int
-
-	ShowTimestamps bool
-	ShowPlayground bool
-	DeclLinks      bool
-
-	// NotesRx optionally specifies a regexp to match
-	// notes to render in the output.
-	NotesRx *regexp.Regexp
-
-	// AdjustPageInfoMode optionally specifies a function to
-	// modify the PageInfoMode of a request. The default chosen
-	// value is provided.
-	AdjustPageInfoMode func(req *http.Request, mode PageInfoMode) PageInfoMode
-
-	// URLForSrc optionally specifies a function that takes a source file and
-	// returns a URL for it.
-	// The source file argument has the form /src/<path>/<filename>.
-	URLForSrc func(src string) string
-
-	// URLForSrcPos optionally specifies a function to create a URL given a
-	// source file, a line from the source file (1-based), and low & high offset
-	// positions (0-based, bytes from beginning of file). Ideally, the returned
-	// URL will be for the specified line of the file, while the high & low
-	// positions will be used to highlight a section of the file.
-	// The source file argument has the form /src/<path>/<filename>.
-	URLForSrcPos func(src string, line, low, high int) string
-
-	// URLForSrcQuery optionally specifies a function to create a URL given a
-	// source file, a query string, and a line from the source file (1-based).
-	// The source file argument has the form /src/<path>/<filename>.
-	// The query argument will be escaped for the purposes of embedding in a URL
-	// query parameter.
-	// Ideally, the returned URL will be for the specified line of the file with
-	// the query string highlighted.
-	URLForSrcQuery func(src, query string, line int) string
-
 	// GoogleCN reports whether this request should be marked GoogleCN.
 	// If the function is nil, no requests are marked GoogleCN.
 	GoogleCN func(*http.Request) bool
@@ -90,9 +51,6 @@
 		Corpus:     c,
 		mux:        http.NewServeMux(),
 		fileServer: http.FileServer(http.FS(c.fs)),
-
-		TabWidth:  4,
-		DeclLinks: true,
 	}
 	p.cmdHandler = handlerServer{
 		p:       p,
diff --git a/internal/godoc/server.go b/internal/godoc/server.go
index 9df87ae..6640d97 100644
--- a/internal/godoc/server.go
+++ b/internal/godoc/server.go
@@ -30,7 +30,6 @@
 	"strconv"
 	"strings"
 	"text/template"
-	"time"
 
 	"golang.org/x/website/internal/spec"
 	"golang.org/x/website/internal/texthtml"
@@ -176,22 +175,7 @@
 				log.Println("parsing examples:", err)
 			}
 			info.Examples = collectExamples(h.c, pkg, files)
-
-			// collect any notes that we want to show
-			if info.PDoc.Notes != nil {
-				// could regexp.Compile only once per godoc, but probably not worth it
-				if rx := h.p.NotesRx; rx != nil {
-					for m, n := range info.PDoc.Notes {
-						if rx.MatchString(m) {
-							if info.Notes == nil {
-								info.Notes = make(map[string][]*doc.Note)
-							}
-							info.Notes[m] = n
-						}
-					}
-				}
-			}
-
+			info.Bugs = info.PDoc.Notes["BUG"]
 		} else {
 			// show source code
 			// TODO(gri) Consider eliminating export filtering in this mode,
@@ -206,13 +190,11 @@
 
 	// get directory information, if any
 	var dir *Directory
-	var timestamp time.Time
-	if tree, ts := h.c.fsTree.Get(); tree != nil && tree.(*Directory) != nil {
+	if tree, _ := h.c.fsTree.Get(); tree != nil && tree.(*Directory) != nil {
 		// directory tree is present; lookup respective directory
 		// (may still fail if the file system was updated and the
 		// new directory tree has not yet been computed)
 		dir = tree.(*Directory).lookup(abspath)
-		timestamp = ts
 	}
 	if dir == nil {
 		// TODO(agnivade): handle this case better, now since there is no CLI mode.
@@ -222,11 +204,8 @@
 		// note: cannot use path filter here because in general
 		// it doesn't contain the FSTree path
 		dir = h.c.newDirectory(abspath, 2)
-		timestamp = time.Now()
 	}
 	info.Dirs = dir.listing(true, func(path string) bool { return h.includePath(path, mode) })
-
-	info.DirTime = timestamp
 	info.DirFlat = mode&FlatDir != 0
 
 	return info
@@ -273,7 +252,7 @@
 	}
 
 	abspath := pathpkg.Join(h.fsRoot, relpath)
-	mode := h.p.GetPageInfoMode(r)
+	mode := GetPageInfoMode(r.FormValue("m"))
 	if relpath == builtinPkgPath {
 		// The fake built-in package contains unexported identifiers,
 		// but we want to show them. Also, disable type association,
@@ -299,9 +278,6 @@
 	default:
 		tabtitle = info.Dirname
 		title = "Directory "
-		if h.p.ShowTimestamps {
-			subtitle = "Last update: " + info.DirTime.String()
-		}
 	}
 	if title == "" {
 		if info.IsMain {
@@ -349,8 +325,6 @@
 type PageInfoMode uint
 
 const (
-	PageInfoModeQueryString = "m" // query string where PageInfoMode is stored
-
 	NoFiltering PageInfoMode = 1 << iota // do not filter exports
 	AllMethods                           // show all embedded methods
 	ShowSource                           // show source code, do not extract documentation
@@ -387,18 +361,14 @@
 }
 
 // GetPageInfoMode computes the PageInfoMode flags by analyzing the request
-// URL form value "m". It is value is a comma-separated list of mode names
-// as defined by modeNames (e.g.: m=src,text).
-func (p *Presentation) GetPageInfoMode(r *http.Request) PageInfoMode {
+// URL form value "m". It is value is a comma-separated list of mode names (for example, "all,flat").
+func GetPageInfoMode(text string) PageInfoMode {
 	var mode PageInfoMode
-	for _, k := range strings.Split(r.FormValue(PageInfoModeQueryString), ",") {
+	for _, k := range strings.Split(text, ",") {
 		if m, found := modeNames[strings.TrimSpace(k)]; found {
 			mode |= m
 		}
 	}
-	if p.AdjustPageInfoMode != nil {
-		mode = p.AdjustPageInfoMode(r, mode)
-	}
 	return mode
 }
 
@@ -585,7 +555,7 @@
 		return
 	}
 
-	if r.FormValue(PageInfoModeQueryString) == "text" {
+	if r.FormValue("m") == "text" {
 		p.ServeText(w, src)
 		return
 	}