Documentation ¶
Index ¶
- Variables
- type Block
- type CodeBlock
- type CommentBlock
- type HeaderBlock
- type Package
- type ParameterBlock
- type Pos
- type PrintBlock
- type RawPrintBlock
- type Scanner
- type Template
- func (t *Template) FileName() string
- func (t *Template) Name() string
- func (t *Template) PackageName() (string, error)
- func (t *Template) SourceFile() string
- func (t *Template) String() string
- func (t *Template) TemplateFuncName() string
- func (t *Template) ViewFuncName() string
- func (t *Template) Write(w io.Writer) error
- type TextBlock
- type View
Constants ¶
This section is empty.
Variables ¶
var ( // ErrParameterFormat notifies the user that a parameter tag is poorly formatted. ErrParameterFormat = errors.New("parameters should be of form `param type`") // ErrUnidentifiablePackage notifies the user that the package name can't be // determined ErrUnidentifiablePackage = errors.New("package name cannot be determined") )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block interface {
// contains filtered or unexported methods
}
Block represents an element of the template.
type CommentBlock ¶
CommentBlock represents a block of text which is discarded
type HeaderBlock ¶
HeaderBlock represents a Go code block that is printed at the top of the template.
type Package ¶
type Package struct {
Template *Template
}
Package represents the source file representation of a template. Note that it's on its way out, in favor of this functionality being included in Template.
type ParameterBlock ¶
DeclarationBlock represents a block that declaration the function signature.
type PrintBlock ¶
PrintBlock represents a block that will HTML escape the contents before outputting
type RawPrintBlock ¶
RawPrintBlock represents a block of the template that is printed out to the writer.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is a tokenizer for Ego templates.
func NewScanner ¶
NewScanner initializes a new scanner with a given reader.
type Template ¶
Template represents an entire Ego template. Templates consist of a set of parameters and other block. Blocks can be either a TextBlock, a PrintBlock, a RawPrintBlock, or a CodeBlock.
func Parse ¶
Parse parses an Ego template from a reader. The path specifies the path name used in the compiled template's pragmas.
func (*Template) Name ¶
Name returns a name for the template as a camel cased string based on the filename.
func (*Template) PackageName ¶
PackageName returns the name of the package, based on the last non-file part of the path.
func (*Template) SourceFile ¶
SourceFile returns the path to the source file that should be generated from this template.
func (*Template) TemplateFuncName ¶
TemplateFuncName returns the name of the Template func for this template.
func (*Template) ViewFuncName ¶
ViewFuncName returns the name fo the View func for this template.
type TextBlock ¶
TextBlock represents a UTF-8 encoded block of text that is written to the writer as-is.