Documentation ¶
Index ¶
- func GetExt(s string) string
- func HTML(name string, data interface{}) ([]byte, error)
- func IsDir(dir string) bool
- func IsExist(path string) bool
- func IsFile(path string) bool
- func NewFile(name string, data []byte, ext string) *file
- func Renderer(opt Options)
- type CALLBACK
- type Delims
- type File
- type FileSystem
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDir ¶
IsDir returns true if given path is a directory, and returns false when it's a file or does not exist.
Types ¶
type Delims ¶
type Delims struct { // Left delimiter, defaults to {{ Left string // Right delimiter, defaults to }} Right string }
Delims represents a set of Left and Right delimiters for HTML template rendering
type FileSystem ¶
FileSystem represents a interface of template file system that able to list all files.
func NewCbFS ¶
func NewCbFS(cb CALLBACK, omitData bool) FileSystem
func NewFS ¶
func NewFS(opt Options, omitData bool) FileSystem
NewTemplateFileSystem creates new template file system with given options.
type Options ¶
type Options struct { // Directory to load templates. Default is "templates". Directory string // Addtional directories to overwite templates. AppendDirectories []string // Layout template name. Will not render a layout if "". Default is to "". Layout string // Extensions to parse template files from. Defaults are [".tmpl", ".html"]. Extensions []string // Funcs is a slice of FuncMaps to apply to the template upon compilation. This is useful for helper functions. Default is []. Funcs []template.FuncMap // Delims sets the action delimiters to the specified strings in the Delims struct. Delims Delims // Appends the given charset to the Content-Type header. Default is "UTF-8". Charset string // Outputs human readable JSON. IndentJSON bool // Outputs human readable XML. IndentXML bool // Prefixes the JSON output with the given bytes. PrefixJSON []byte // Prefixes the XML output with the given bytes. PrefixXML []byte // Allows changing of output to XHTML instead of HTML. Default is "text/html" HTMLContentType string // FileSystem is the interface for supporting any implmentation of template file system. FileSystem }
RenderOptions represents a struct for specifying configuration options for the Render middleware.
Click to show internal directories.
Click to hide internal directories.