Skip to content

Commit

Permalink
html/template: Clarifying references to "text/template" in the docume…
Browse files Browse the repository at this point in the history
…ntation.

Fixes #4634.

R=adg, kevlar
CC=golang-dev
https://golang.org/cl/7066053
  • Loading branch information
campoy committed Jan 14, 2013
1 parent a0509d8 commit 1590be9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pkg/html/template/template.go
Expand Up @@ -14,8 +14,8 @@ import (
"text/template/parse"
)

// Template is a specialized template.Template that produces a safe HTML
// document fragment.
// Template is a specialized Template from "text/template" that produces a safe
// HTML document fragment.
type Template struct {
escaped bool
// We could embed the text/template field, but it's safer not to because
Expand Down Expand Up @@ -238,7 +238,8 @@ func (t *Template) Name() string {
// return values of which the second has type error. In that case, if the
// second (error) argument evaluates to non-nil during execution, execution
// terminates and Execute returns that error. FuncMap has the same base type
// as template.FuncMap, copied here so clients need not import "text/template".
// as FuncMap in "text/template", copied here so clients need not import
// "text/template".
type FuncMap map[string]interface{}

// Funcs adds the elements of the argument map to the template's function map.
Expand Down Expand Up @@ -268,7 +269,10 @@ func (t *Template) Lookup(name string) *Template {
return t.set[name]
}

// Must panics if err is non-nil in the same way as template.Must.
// Must is a helper that wraps a call to a function returning (*Template, error)
// and panics if the error is non-nil. It is intended for use in variable initializations
// such as
// var t = template.Must(template.New("name").Parse("html"))
func Must(t *Template, err error) *Template {
if err != nil {
panic(err)
Expand Down

0 comments on commit 1590be9

Please sign in to comment.