engine

package
v0.0.0-...-1ecfe31 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLuaTree = errors.New("luaTreeErr")
View Source
var ErrXMLMarshalling = errors.New("xmlMarshallingErr")

Functions

func EncodeToken

func EncodeToken(e *xml.Encoder, buf io.Writer, t xml.Token) error

Types

type BlockToken

type BlockToken string

BlockToken expresses a 2 char wide token that can be embedded inside CharData.

const (
	BlockTokenStartCode  BlockToken = "[[" // Starts a code block
	BlockTokenEndCode    BlockToken = "]]" // Ends a code block
	BlockTokenStartPrint BlockToken = "[#" // Starts a printing block
	BlockTokenEndPrint   BlockToken = "#]" // Ends a printing block
)

type LuaEngine

type LuaEngine struct {
	// contains filtered or unexported fields
}

func NewLuaEngine

func NewLuaEngine(lt *LuaTree, data *TemplateData) *LuaEngine

func (*LuaEngine) Exec

func (e *LuaEngine) Exec(initFunc string) error

This function is serialized on exec.

func (*LuaEngine) GetNodePath

func (e *LuaEngine) GetNodePath() []*xmltree.Node

Can only be called after Exec() has been run.

func (*LuaEngine) GetNodePathString

func (e *LuaEngine) GetNodePathString() []string

Can only be called after Exec() has been run.

func (*LuaEngine) SetIterationNodes

func (e *LuaEngine) SetIterationNodes(nodes []string)

SetIterationNodes updates the list of node names that act as an iteration origin.

func (*LuaEngine) WriteXML

func (e *LuaEngine) WriteXML(w io.Writer) error

Can only be called after Exec() has been run.

type LuaTree

type LuaTree struct {
	NodeList []*xmltree.Node

	LuaProg string // Lua program representing only the XML tree
	// contains filtered or unexported fields
}

LuaTree represents an XML tree that is encoded into a lua program.

func NewLuaTree

func NewLuaTree(tree *xmltree.Node) (*LuaTree, error)

NewLuaTree converts an XML tree to a lua tree.

func (*LuaTree) RegisterNode

func (t *LuaTree) RegisterNode(node *xmltree.Node) uint32

RegisterNode adds a xmltree node to the node registry of the lua tree, returning the new nodeID.

type TemplateData

type TemplateData struct {
	Data     map[string]any
	Metadata map[string]string
}

Passed data must be a primitive or a map.

Jump to

Keyboard shortcuts

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