Documentation
¶
Overview ¶
Package parser provides a generic interface to a range of different parsers.
Index ¶
- Variables
- func Clean(node *sx.Pair)
- func GetSyntaxes() []string
- func IsASTParser(syntax string) bool
- func IsImageFormat(syntax string) bool
- func Parse(inp *input.Input, m *meta.Meta, syntax string, alst *sx.Pair) *sx.Pair
- func ParseDescription(m *meta.Meta) *sx.Pair
- func ParseDrawBlock(attrs *sx.Pair, content []byte) *sx.Pair
- func ParseZettel(ctx context.Context, zettel zettel.Zettel, syntax string, ...) *ast.Zettel
- type Info
Constants ¶
This section is empty.
Variables ¶
var SymAllowHTML = sx.MakeSymbol("ALLOW-HTML")
SymAllowHTML signals a parser to allow HTML content during parsing.
Functions ¶
func GetSyntaxes ¶
func GetSyntaxes() []string
GetSyntaxes returns a list of syntaxes implemented by all registered parsers.
func IsASTParser ¶
IsASTParser returns whether the given syntax parses text into an AST or not.
func IsImageFormat ¶
IsImageFormat returns whether the given syntax is known to be an image format.
func ParseDescription ¶
ParseDescription returns a suitable description stored in the metadata as an inline list. This is done for an image in most cases.
func ParseDrawBlock ¶
ParseDrawBlock parses the content of an eval verbatim node into an SVG image BLOB.
Types ¶
type Info ¶
type Info struct {
Name string
AltNames []string
IsASTParser bool
IsTextFormat bool
IsImageFormat bool
// Parse the input, with the given metadata, the given syntax, and the given config.
Parse func(*input.Input, *meta.Meta, string, *sx.Pair) *sx.Pair
}
Info describes a single parser.
Before Parse() is called, ensure the input stream to be valid. This can be achieved on calling inp.Next() after the input stream was created.