Documentation ¶
Overview ¶
Package load glues everything together to provide a higher-level interfaces for loading Booklit documents into Sections, either from files or from already-parsed nodes (i.e. for inline sections).
Index ¶
- type Processor
- func (processor *Processor) EvaluateFile(parent *booklit.Section, path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
- func (processor *Processor) EvaluateNode(parent *booklit.Section, node ast.Node, ...) (*booklit.Section, error)
- func (processor *Processor) LoadFile(path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
- func (processor *Processor) LoadFileIn(parent *booklit.Section, path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor struct { AllowBrokenReferences bool // contains filtered or unexported fields }
Processor is a long-lived object for loading sections and evaluating content.
Document parsing is cached based on file modification time to avoid repeated parsing of sub-sections when section content changes.
func (*Processor) EvaluateFile ¶ added in v0.8.0
func (processor *Processor) EvaluateFile(parent *booklit.Section, path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
EvaluateFile parses the file at the given path and evaluates it, returning a new section with given parent as its Parent.
The returned section will not have been collected or resolved.
func (*Processor) EvaluateNode ¶ added in v0.8.0
func (processor *Processor) EvaluateNode(parent *booklit.Section, node ast.Node, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
EvaluateNode evaluates the given node and returns a new section with the given parent as its Parent.
The returned section will not have been collected or resolved.
func (*Processor) LoadFile ¶
func (processor *Processor) LoadFile(path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
LoadFile parses the file at the given path and runs the three stages to yield a Section.
func (*Processor) LoadFileIn ¶ added in v0.10.0
func (processor *Processor) LoadFileIn(parent *booklit.Section, path string, pluginFactories []booklit.PluginFactory) (*booklit.Section, error)
LoadFileIn parses the file at the given path and runs the evaluate, collect, and resolve stages to yield a Section.
The given parent section is assigned as the parent of the new section so that tags may resolve using the parent.