Documentation ¶
Overview ¶
Package parser provides a generic interface to a range of different parsers.
Index ¶
- func GetSyntaxes() []string
- func IsASTParser(syntax string) bool
- func IsImageFormat(syntax string) bool
- func NormalizedSpacedText(s string) string
- func ParseBlocks(inp *input.Input, m *meta.Meta, syntax string, hi config.HTMLInsecurity) ast.BlockSlice
- func ParseDescription(m *meta.Meta) ast.InlineSlice
- func ParseInlines(inp *input.Input, syntax string) ast.InlineSlice
- func ParseMetadata(value string) ast.InlineSlice
- func ParseSpacedText(s string) ast.InlineSlice
- func ParseZettel(ctx context.Context, zettel zettel.Zettel, syntax string, ...) *ast.ZettelNode
- func Register(pi *Info)
- type Info
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSyntaxes ¶ added in v0.0.15
func GetSyntaxes() []string
GetSyntaxes returns a list of syntaxes implemented by all registered parsers.
func IsASTParser ¶ added in v0.9.0
IsASTParser returns whether the given syntax parses text into an AST or not.
func IsImageFormat ¶ added in v0.0.15
IsImageFormat returns whether the given syntax is known to be an image format.
func NormalizedSpacedText ¶ added in v0.11.0
NormalizedSpacedText returns the given string, but normalize multiple spaces to one space.
func ParseBlocks ¶ added in v0.0.15
func ParseBlocks(inp *input.Input, m *meta.Meta, syntax string, hi config.HTMLInsecurity) ast.BlockSlice
ParseBlocks parses some input and returns a slice of block nodes.
func ParseDescription ¶ added in v0.10.0
func ParseDescription(m *meta.Meta) ast.InlineSlice
ParseDescription returns a suitable description stored in the metadata as an inline slice. This is done for an image in most cases.
func ParseInlines ¶ added in v0.0.15
func ParseInlines(inp *input.Input, syntax string) ast.InlineSlice
ParseInlines parses some input and returns a slice of inline nodes.
func ParseMetadata ¶ added in v0.0.15
func ParseMetadata(value string) ast.InlineSlice
ParseMetadata parses a string as Zettelmarkup, resulting in an inline slice. Typically used to parse the title or other metadata of type Zettelmarkup.
func ParseSpacedText ¶ added in v0.11.0
func ParseSpacedText(s string) ast.InlineSlice
ParseSpacedText returns an inline slice that consists just of test and space node. No Zettelmarkup parsing is done. It is typically used to transform the zettel title into an inline slice.
Types ¶
type Info ¶
type Info struct { Name string AltNames []string IsASTParser bool IsTextFormat bool IsImageFormat bool ParseBlocks func(*input.Input, *meta.Meta, string) ast.BlockSlice ParseInlines func(*input.Input, string) ast.InlineSlice }
Info describes a single parser.
Before ParseBlocks() or ParseInlines() is called, ensure the input stream to be valid. This can ce achieved on calling inp.Next() after the input stream was created.
Directories ¶
Path | Synopsis |
---|---|
Package blob provides a parser of binary data.
|
Package blob provides a parser of binary data. |
Package cleaner provides functions to clean up the parsed AST.
|
Package cleaner provides functions to clean up the parsed AST. |
Package draw provides a parser to create SVG from ASCII drawing.
|
Package draw provides a parser to create SVG from ASCII drawing. |
Package markdown provides a parser for markdown.
|
Package markdown provides a parser for markdown. |
Package none provides a none-parser, e.g.
|
Package none provides a none-parser, e.g. |
Package plain provides a parser for plain text data.
|
Package plain provides a parser for plain text data. |
Package zettelmark provides a parser for zettelmarkup.
|
Package zettelmark provides a parser for zettelmarkup. |