Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDeclarationRequired is returned when there is no declaration block // in a template. ErrDeclarationRequired = errors.New("declaration required") )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block interface {
// contains filtered or unexported methods
}
Block represents an element of the template.
type DeclarationBlock ¶
DeclarationBlock represents a block that declaration the function signature.
type HeaderBlock ¶
HeaderBlock represents a Go code block that is printed at the top of the template.
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. A template consists of a declaration block followed by zero or more blocks. 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.