Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fc61bd0213
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (24 sloc) 0.634 kb
package templatesystem
import (
"io"
"io/ioutil"
"path/filepath"
)
type PassThroughTemplate struct {
text string
}
func (self *PassThroughTemplate) Render(out io.Writer, context interface{}) (err error) {
_, err = out.Write([]byte(self.text))
return err
}
type PassThrough struct{}
func (self *PassThrough) ParseFile(filename string) (Template, error) {
text, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return self.ParseString(string(text), filepath.Base(filename))
}
func (self *PassThrough) ParseString(text, name string) (Template, error) {
return &PassThroughTemplate{text: text}, nil
}
Jump to Line
Something went wrong with that request. Please try again.