const builtinPkgPath … // FuncMap defines template functions used in godoc templates. // // Convention: template function names ending in "_html" or "_url" produce // HTML- or URL-escaped strings; all other function results may // require explicit escaping in the template. func (p *Presentation) FuncMap() template.FuncMap { … } func (p *Presentation) TemplateFuncs() template.FuncMap { … } func (p *Presentation) initFuncMap() { … } func multiply(a, b int) int { … } func filenameFunc(path string) string { … } func fileInfoNameFunc(fi os.FileInfo) string { … } func fileInfoTimeFunc(fi os.FileInfo) string { … } var infoKinds … func infoKind_htmlFunc(info SpotInfo) string { … } func (p *Presentation) infoLineFunc(info SpotInfo) int { … } func (p *Presentation) infoSnippet_htmlFunc(info SpotInfo) string { … } func (p *Presentation) nodeFunc(info *PageInfo, node interface{ … } func (p *Presentation) node_htmlFunc(info *PageInfo, node interface{ … } // isStructTypeDecl checks whether n is a struct declaration. // It either returns a non-nil StructType and its name, or zero values. func isStructTypeDecl(n ast.Node) (st *ast.StructType, name string) { … } // addStructFieldIDAttributes modifies the contents of buf such that // all struct fields of the named struct have <span id='name.Field'> // in them, so people can link to /#Struct.Field. func addStructFieldIDAttributes(buf *bytes.Buffer, name string, st *ast.StructType) { … } // foreachLine calls fn for each line of in, where a line includes // the trailing "\n", except on the last line, if it doesn't exist. func foreachLine(in []byte, fn func(line []byte)) { … } var commentPrefix … // linkedField determines whether the given line starts with an // identifier in the provided ids map (mapping from identifier to the // same identifier). The line can start with either an identifier or // an identifier in a comment. If one matches, it returns the // identifier that matched. Otherwise it returns the empty string. func linkedField(line []byte, ids map[string]string) string { … } // scanIdentifier scans a valid Go identifier off the front of v and // either returns a subslice of v if there's a valid identifier, or // returns a zero-length slice. func scanIdentifier(v []byte) []byte { … } func isLetter(ch rune) bool { … } func isDigit(ch rune) bool { … } func comment_htmlFunc(info *PageInfo, comment string) string { … } // sanitizeFunc sanitizes the argument src by replacing newlines with // blanks, removing extra blanks, and by removing trailing whitespace // and commas before closing parentheses. func sanitizeFunc(src string) string { … } type PageInfo … func (info *PageInfo) IsEmpty() bool { … } func pkgLinkFunc(path string) string { … } // srcToPkgLinkFunc builds an <a> tag linking to the package // documentation of relpath. func srcToPkgLinkFunc(relpath string) string { … } // srcBreadcrumbFunc converts each segment of relpath to a HTML <a>. // Each segment links to its corresponding src directories. func srcBreadcrumbFunc(relpath string) string { … } func newPosLink_urlFunc(srcPosLinkFunc func(s string, line, low, high int) string) func(info *PageInfo, n interface{ … } func srcPosLinkFunc(s string, line, low, high int) string { … } func srcLinkFunc(s string) string { … } // queryLinkFunc returns a URL for a line in a source file with a highlighted // query term. // s is expected to be a path to a source file. // query is expected to be a string that has already been appropriately escaped // for use in a URL query. func queryLinkFunc(s, query string, line int) string { … } func docLinkFunc(s string, ident string) string { … } func (p *Presentation) example_htmlFunc(info *PageInfo, funcName string) string { … } func filterOutBuildAnnotations(cg []*ast.CommentGroup) []*ast.CommentGroup { … } // example_nameFunc takes an example function name and returns its display // name. For example, "Foo_Bar_quux" becomes "Foo.Bar (Quux)". func (p *Presentation) example_nameFunc(s string) string { … } // example_suffixFunc takes an example function name and returns its suffix in // parenthesized form. For example, "Foo_Bar_quux" becomes " (Quux)". func (p *Presentation) example_suffixFunc(name string) string { … } // implements_htmlFunc returns the "> Implements" toggle for a package-level named type. // Its contents are populated from JSON data by client-side JS at load time. func (p *Presentation) implements_htmlFunc(info *PageInfo, typeName string) string { … } // methodset_htmlFunc returns the "> Method set" toggle for a package-level named type. // Its contents are populated from JSON data by client-side JS at load time. func (p *Presentation) methodset_htmlFunc(info *PageInfo, typeName string) string { … } // callgraph_htmlFunc returns the "> Call graph" toggle for a package-level func. // Its contents are populated from JSON data by client-side JS at load time. func (p *Presentation) callgraph_htmlFunc(info *PageInfo, recv, name string) string { … } func noteTitle(note string) string { … } func startsWithUppercase(s string) bool { … } var exampleOutputRx … // stripExampleSuffix strips lowercase braz in Foo_braz or Foo_Bar_braz from name // while keeping uppercase Braz in Foo_Braz. func stripExampleSuffix(name string) string { … } func splitExampleName(s string) (name, suffix string) { … } // replaceLeadingIndentation replaces oldIndent at the beginning of each line // with newIndent. This is used for formatting examples. Raw strings that // span multiple lines are handled specially: oldIndent is not removed (since // go/printer will not add any indentation there), but newIndent is added // (since we may still want leading indentation). func replaceLeadingIndentation(body, oldIndent, newIndent string) string { … } // writeNode writes the AST node x to w. // // The provided fset must be non-nil. The pageInfo is optional. If // present, the pageInfo is used to add comments to struct fields to // say which version of Go introduced them. func (p *Presentation) writeNode(w io.Writer, pageInfo *PageInfo, fset *token.FileSet, x interface{ … } var slashSlash … // WriteNode writes x to w. // TODO(bgarcia) Is this method needed? It's just a wrapper for p.writeNode. func (p *Presentation) WriteNode(w io.Writer, fset *token.FileSet, x interface{ … } // firstIdent returns the first identifier in x. // This actually parses "identifiers" that begin with numbers too, but we // never feed it such input, so it's fine. func firstIdent(x []byte) string { … }