Documentation
¶
Index ¶
- Constants
- func ExpressionUnits(source []byte) (invalid, unclosed [][2]int)
- func FirstInvalidCompParamDef(source []byte) (string, bool)
- func InlineUnits(source []byte) (codes [][2]int, units [][2]int)
- func MustacheCallEnd(source []byte, start int) (int, bool)
- func NewAll() *all
- func NewQuotedStringInner() *quotedStringInner
- func NewSinceFirstMatchInner(regex string) *sinceFirstMatchInner
- func NewStartEndInner(startWith, endWith string) *startEndInner
- type Named
- type Selector
- func NewArrayInner() Selector
- func NewArrayItems(allowParamRef bool) Selector
- func NewArrayLiteral(allowParamRef bool) Selector
- func NewBoundArgs() Selector
- func NewBounds(start, end Selector) Selector
- func NewComponentAssignments(requireValue bool) Selector
- func NewComponentReference() Selector
- func NewContextMustacheCall() Selector
- func NewFilter(selector Selector, callback func([]byte, [][2]int) [][2]int) Selector
- func NewInvalidExpressions(block bool) Selector
- func NewMarkdownLink(part markdownLinkPart) Selector
- func NewMustacheCall(paramRefName bool) Selector
- func NewParamRefIndexes() Selector
- func NewPattern(ptrn string) (Selector, error)
- func NewRecordInner() Selector
- func NewRecordItems(allowParamRef bool) Selector
- func NewRecordLiteral(allowParamRef bool) Selector
- func NewStartEnd(startWith, endWith string) (Selector, error)
- func NewStartEndLeftInner(startWith, endWith string) (Selector, error)
- func NewUnclosedExpressions() Selector
Constants ¶
const ( MarkdownLinkWhole markdownLinkPart = iota MarkdownLinkText MarkdownLinkURL )
Variables ¶
This section is empty.
Functions ¶
func ExpressionUnits ¶ added in v0.7.0
ExpressionUnits returns the {{ }} units of source that follow no grammar and the {{ that are not closed, recognized like InlineUnits: a {{ inside a code span is text. Each unclosed range is the two bytes of its {{.
func FirstInvalidCompParamDef ¶ added in v0.7.0
FirstInvalidCompParamDef scans component parameter definitions, the part of a component definition head after the component name, and returns the text of the first invalid definition. Each definition must be a name ([a-z][a-z0-9-]*), an optional '!' glued to the name, optional spaces, '=', optional spaces and a value accepted by scanComponentValue. The bool is false when every definition is valid.
func InlineUnits ¶ added in v0.7.0
InlineUnits returns the code spans and the {{ }} units of source, recognized from left to right: whichever opens first wins, and the delimiters of the other inside it are plain text.
func MustacheCallEnd ¶ added in v0.7.0
MustacheCallEnd returns the end of the component call that starts at start, and false if no valid call starts there.
func NewQuotedStringInner ¶ added in v0.7.0
func NewQuotedStringInner() *quotedStringInner
func NewSinceFirstMatchInner ¶
func NewSinceFirstMatchInner(regex string) *sinceFirstMatchInner
func NewStartEndInner ¶
func NewStartEndInner(startWith, endWith string) *startEndInner
Types ¶
type Selector ¶
func NewArrayInner ¶ added in v0.3.0
func NewArrayInner() Selector
func NewArrayItems ¶ added in v0.3.0
func NewArrayLiteral ¶ added in v0.3.0
func NewBoundArgs ¶ added in v0.7.0
func NewBoundArgs() Selector
NewBoundArgs selects the parenthesized bound arguments of a component value.
func NewComponentAssignments ¶ added in v0.3.0
func NewComponentReference ¶ added in v0.7.0
func NewComponentReference() Selector
NewComponentReference selects the whole source when it is a component value: a component name optionally followed by bound arguments.
func NewContextMustacheCall ¶ added in v0.4.0
func NewContextMustacheCall() Selector
func NewInvalidExpressions ¶ added in v0.7.0
NewInvalidExpressions selects the {{ }} units that follow no grammar. A unit's }} is searched for within the range it starts in. With block, a range is first split at every blank line, and only a unit that stands on its own lines is selected: nothing but spaces and tabs comes before it on its first line and after it on its last line.
func NewMarkdownLink ¶ added in v0.7.0
func NewMarkdownLink(part markdownLinkPart) Selector
func NewMustacheCall ¶ added in v0.3.0
func NewParamRefIndexes ¶ added in v0.3.0
func NewParamRefIndexes() Selector
func NewPattern ¶
func NewRecordInner ¶ added in v0.3.0
func NewRecordInner() Selector
func NewRecordItems ¶ added in v0.3.0
func NewRecordLiteral ¶ added in v0.3.0
func NewStartEnd ¶
func NewStartEndLeftInner ¶
func NewUnclosedExpressions ¶ added in v0.7.0
func NewUnclosedExpressions() Selector
NewUnclosedExpressions selects the two bytes of every {{ that is not closed within the range it starts in.