1
0
mirror of https://github.com/golang/go synced 2024-10-05 04:31:22 -06:00
go/src/pkg/html
Mike Samuel a5291099d2 html/template: wraps package template instead of exposing func Escape
This does escaping on first execution.

template.go defines the same interface elements as package template.
It requires rather more duplication of code than I'd like, but I'm
not clear how to avoid that.

Maybe instead of

    mySet.ParseGlob(...)
    template.ParseSetGlob(...)
    mySet.ParseFiles(...)
    mySet.ParseTemplateFiles(...)
    template.ParseTemplateFiles(...)

we combine these into a fileset abstraction that can be wrapped

    var fileset template.FileSet
    fileset.Glob(...)  // Load a few files by glob
    fileset.Files(...)  // Load a few {{define}}d files
    fileset.TemplateFiles(...)  // Load a few files as template bodies
    fileset.Funcs(...)  // Make the givens func available to templates
    // Do the parsing.
    set, err := fileset.ParseSet()
    // or set, err := fileset.ParseInto(set)

or provide an interface that can receive filenames and functions and
parse messages:

    type Bundle interface {
      TemplateFile(string)
      File(string)
      Funcs(FuncMap)
    }

and define template.Parse* to handle the file-system stuff and send
messages to a bundle:

    func ParseFiles(b Bundle, filenames ...string)

R=r, r
CC=golang-dev
https://golang.org/cl/5270042
2011-11-04 13:09:21 -04:00
..
template html/template: wraps package template instead of exposing func Escape 2011-11-04 13:09:21 -04:00
testdata/webkit html: sync html/testdata/webkit with upstream WebKit. 2011-07-21 12:50:45 +10:00
const.go html: parse misnested formatting tags according to the HTML5 spec. 2011-07-21 11:20:54 +10:00
doc.go all: rename os.EOF to io.EOF in various non-code contexts 2011-11-03 14:01:30 -07:00
entity_test.go
entity.go cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune 2011-10-25 22:20:02 -07:00
escape.go src/pkg/[a-m]*: gofix -r error -force=error 2011-11-01 22:04:37 -04:00
Makefile html: add a Render function. 2011-10-10 14:44:37 +11:00
node.go html: stop at scope marker node when generating implied </a> tags 2011-11-02 11:47:05 +11:00
parse_test.go html: properly close <tr> element when an new <tr> starts. 2011-11-04 15:48:11 +11:00
parse.go html,bzip2,sql: rename Error methods that return error to Err 2011-11-04 09:50:20 -04:00
render_test.go html: add a Render function. 2011-10-10 14:44:37 +11:00
render.go src/pkg/[a-m]*: gofix -r error -force=error 2011-11-01 22:04:37 -04:00
token_test.go html,bzip2,sql: rename Error methods that return error to Err 2011-11-04 09:50:20 -04:00
token.go html,bzip2,sql: rename Error methods that return error to Err 2011-11-04 09:50:20 -04:00