load

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: MIT Imports: 7 Imported by: 0

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

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.

Jump to

Keyboard shortcuts

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