Help us shape the future of Go! Take the 2026 Go Developer Survey

selector

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarkdownLinkWhole markdownLinkPart = iota
	MarkdownLinkText
	MarkdownLinkURL
)

Variables

This section is empty.

Functions

func ExpressionUnits added in v0.7.0

func ExpressionUnits(source []byte) (invalid, unclosed [][2]int)

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

func FirstInvalidCompParamDef(source []byte) (string, bool)

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

func InlineUnits(source []byte) (codes [][2]int, units [][2]int)

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

func MustacheCallEnd(source []byte, start int) (int, bool)

MustacheCallEnd returns the end of the component call that starts at start, and false if no valid call starts there.

func NewAll

func NewAll() *all

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 Named

type Named interface {
	Name() string
}

type Selector

type Selector interface {
	Select(source []byte, without ...[2]int) [][2]int
}

func NewArrayInner added in v0.3.0

func NewArrayInner() Selector

func NewArrayItems added in v0.3.0

func NewArrayItems(allowParamRef bool) Selector

func NewArrayLiteral added in v0.3.0

func NewArrayLiteral(allowParamRef bool) Selector

func NewBoundArgs added in v0.7.0

func NewBoundArgs() Selector

NewBoundArgs selects the parenthesized bound arguments of a component value.

func NewBounds

func NewBounds(start, end Selector) Selector

func NewComponentAssignments added in v0.3.0

func NewComponentAssignments(requireValue bool) Selector

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 NewFilter

func NewFilter(selector Selector, callback func([]byte, [][2]int) [][2]int) Selector

func NewInvalidExpressions added in v0.7.0

func NewInvalidExpressions(block bool) Selector

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(part markdownLinkPart) Selector

func NewMustacheCall added in v0.3.0

func NewMustacheCall(paramRefName bool) Selector

func NewParamRefIndexes added in v0.3.0

func NewParamRefIndexes() Selector

func NewPattern

func NewPattern(ptrn string) (Selector, error)

func NewRecordInner added in v0.3.0

func NewRecordInner() Selector

func NewRecordItems added in v0.3.0

func NewRecordItems(allowParamRef bool) Selector

func NewRecordLiteral added in v0.3.0

func NewRecordLiteral(allowParamRef bool) Selector

func NewStartEnd

func NewStartEnd(startWith, endWith string) (Selector, error)

func NewStartEndLeftInner

func NewStartEndLeftInner(startWith, endWith string) (Selector, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL