Documentation ¶
Overview ¶
Package markup contains the code used to parse the markup tags in a line of dialogue, along with markup processors that can be used to eg. handle plurals and ordinals. It is called automatically by dialogue runners so users of ysgo generally shouldn't have to directly deal with this package.
Index ¶
Constants ¶
const ( // All the types that an attribute property can hold. ValueTypeInteger = ValueType(iota) ValueTypeFloat ValueTypeString ValueTypeBool )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { Position int Length int Name string Properties map[string]Value SourcePosition int }
Attribute holds data about a section of text between two markup tags.
type LineParser ¶
type LineParser struct {
// contains filtered or unexported fields
}
LineParser can parse the markup from a line of text. It's pretty much a direct port of the LineParser.cs file of YarnSpinner from C# to Go.
func (*LineParser) ParseMarkup ¶
func (lineParser *LineParser) ParseMarkup(input string) (*ParseResult, error)
ParseMarkup parses a line of text to extract the markup metadata.
type ParseResult ¶
ParseResult is the result of parsing a line of text into interpolated text and a set of markup attributes.
func (*ParseResult) Attribute ¶
func (parseResult *ParseResult) Attribute(name string) (Attribute, bool)
Attribute returns the value of the attribute with the given name, if there is one.
func (*ParseResult) TextForAttribute ¶
func (parseResult *ParseResult) TextForAttribute(attribute Attribute) string
TextForAttribute returns the part of the parsed line of text that is covered by the given attribute.