engine

package
v1.0.0-prealpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHTMLData       = errors.New("no 'html' data found")
	ErrDuplicateTagData = errors.New("duplicate tag found")
	ErrInvalidTypeAttr  = errors.New("invalid 'type' attribute")
)

Functions

func Build

func Build(s Settings) chan error

Types

type Component

type Component struct {
	Name   string
	HTML   string
	Style  string
	Script string
	Type   ComponentType
}

Component struct to store extracted content

func NewComponent

func NewComponent(name string, content []byte) (c Component, err error)

func (Component) WrappedDynamicHTML

func (c Component) WrappedDynamicHTML() string

func (Component) WrappedStaticHTML

func (c Component) WrappedStaticHTML() string

func (Component) WrappedStyle

func (c Component) WrappedStyle() string

func (Component) WriteScript

func (c Component) WriteScript(fpath string) error

func (Component) WriteStyle

func (c Component) WriteStyle(fpath string) error

type ComponentInfo

type ComponentInfo struct {
	Props map[string]any
	// contains filtered or unexported fields
}

type ComponentType

type ComponentType uint8

type Settings

type Settings struct {
	Var       map[string]any      `json:"vars,omitempty"`
	Commands  map[string][]string `json:"commands,omitempty"`
	OutputDir string              `json:"output_dir,omitempty"`
	InputDir  string              `json:"input_dir,omitempty"`
}

func (Settings) ScriptPath

func (s Settings) ScriptPath(filename string) string

func (Settings) StylePath

func (s Settings) StylePath(filename string) string

type TemplateData

type TemplateData struct {
	Settings
	StylePaths  []string
	ScriptPaths []string
	// contains filtered or unexported fields
}

func NewTemplateData

func NewTemplateData(s Settings) *TemplateData

func (*TemplateData) AddComponent

func (td *TemplateData) AddComponent(c Component) (err error)

func (*TemplateData) Build

func (td *TemplateData) Build() chan error

func (*TemplateData) Walk

func (td *TemplateData) Walk() (errch chan error)

func (TemplateData) WriteComponent

func (td TemplateData) WriteComponent(c Component) (err error)

Jump to

Keyboard shortcuts

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