Documentation
¶
Index ¶
- Variables
- func Plugin(opts ...PluginOption) api.Plugin
- func Render(w io.Writer, n *Node) (int, error)
- type Attribute
- type Node
- type NodeType
- type PathComponent
- type PluginOption
- type TokenType
- type Tokenizer
- func (t *Tokenizer) Comment() []byte
- func (t *Tokenizer) ControlName() []byte
- func (t *Tokenizer) Err() error
- func (t *Tokenizer) Next() TokenType
- func (t *Tokenizer) Raw() []byte
- func (t *Tokenizer) TagAttr() (key []byte, val []byte, isExpr bool, moreAttr bool)
- func (t *Tokenizer) TagName() ([]byte, bool)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrErrorNode = errors.New("cannot render an ErrorNode node") ErrUnknownNode = errors.New("unknown node type") ErrVoidChildren = errors.New("void element has child nodes") ErrTooManyChildren = errors.New("node allows only a single child") ErrChildOnly = errors.New("node must appear inside an element node") ErrTopLevelOnly = errors.New("node must appear at the top level") ErrMissingBody = errors.New("node must have children") )
Functions ¶
func Plugin ¶
func Plugin(opts ...PluginOption) api.Plugin
Types ¶
type Node ¶
type Node struct {
Parent, FirstChild, LastChild, PrevSibling, NextSibling *Node
Type NodeType
DataAtom atom.Atom
Data string
Attr []Attribute
Path []PathComponent
}
func (*Node) AppendChild ¶
AppendChild adds a node c as a child of n.
It will panic if c already has a parent or siblings.
func (*Node) InsertBefore ¶
InsertBefore inserts newChild as a child of n, immediately before oldChild in the sequence of n's children. oldChild may be nil, in which case newChild is appended to the end of n's children.
It will panic if newChild already has a parent or siblings.
func (*Node) RemoveChild ¶
RemoveChild removes a node c that is a child of n. Afterwards, c will have no parent and no siblings.
It will panic if c's parent is not n.
type PathComponent ¶
type PluginOption ¶ added in v0.2.0
type PluginOption func(*pluginConfig)
func WithExtensionName ¶ added in v0.2.0
func WithExtensionName(extName string) PluginOption
func WithTagMappings ¶ added in v0.2.0
func WithTagMappings(tagMappings map[string]string) PluginOption
func WithTagPrefixes ¶ added in v0.2.0
func WithTagPrefixes(tagPrefixes map[string]string) PluginOption
type Tokenizer ¶
type Tokenizer struct {
// contains filtered or unexported fields
}
Tokenizer holds state for parsing.
func NewTokenizer ¶
func (*Tokenizer) ControlName ¶
ControlName extracts the name of a section, inverted section, or end section.
Click to show internal directories.
Click to hide internal directories.