1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:04:46 -07:00
go/godoc/pres.go
Brad Fitzpatrick 66f0d6e92e godoc: more cleanup
cmd/godoc/godoc.go is now merged into main.go, which is now
only 530 lines.

App Engine mode is still broken, but should be easy to fix up.
(just needs a global *godoc.Presentation created in init)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11498044
2013-07-18 13:51:17 +10:00

56 lines
1.0 KiB
Go

// Copyright 2013 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.
package godoc
import (
"regexp"
"sync"
"text/template"
)
// Presentation generates output from a corpus.
type Presentation struct {
Corpus *Corpus
DirlistHTML,
ErrorHTML,
ExampleHTML,
GodocHTML,
PackageHTML,
PackageText,
SearchHTML,
SearchText,
SearchDescXML *template.Template
// TabWidth optionally specifies the tab width.
TabWidth int
ShowTimestamps bool
ShowPlayground bool
ShowExamples bool
DeclLinks bool
// NotesRx optionally specifies a regexp to match
// notes to render in the output.
NotesRx *regexp.Regexp
initFuncMapOnce sync.Once
funcMap template.FuncMap
templateFuncs template.FuncMap
}
// NewPresentation returns a new Presentation from a corpus.
func NewPresentation(c *Corpus) *Presentation {
if c == nil {
panic("nil Corpus")
}
return &Presentation{
Corpus: c,
TabWidth: 4,
ShowExamples: true,
DeclLinks: true,
}
}