qweb

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOut     = "t-out"
	TForeach = "t-foreach"
	TAs      = "t-as"
	TIf      = "t-if"
	TAttr    = "t-att"
	TBR      = "t-break-line"
)

Variables

View Source
var UndefinedNodeError = errors.New("node is undefined")

Functions

func Eval

func Eval[T any](ctx RenderContext, value string) (T, error)

func GetNodeIndent

func GetNodeIndent(node *Node) string

func IsLineBreakNode added in v0.1.2

func IsLineBreakNode(node *Node) bool

func Parse

func Parse(r io.Reader, root *Node) error

func QAttrs2Attrs

func QAttrs2Attrs(input Attrs) []xml.Attr

func RemoveLineBreak added in v0.1.2

func RemoveLineBreak(node *Node) bool

func RenderString

func RenderString(ctx RenderContext, src *Node) (value string, fErr error)

Types

type Attrs

type Attrs map[string]string

func (*Attrs) Has

func (na *Attrs) Has(key string) bool

type Node

type Node struct {
	Parent  weak.Pointer[Node]
	Name    string
	Content string
	Attrs   Attrs
	TAttrs  Attrs
	Nodes   []*Node
}

func Render

func Render(ctx RenderContext, src *Node) (*Node, error)

func (*Node) Clone

func (node *Node) Clone() *Node

func (*Node) Copy

func (node *Node) Copy(target *Node)

func (*Node) Next

func (node *Node) Next() (int, *Node, error)

func (*Node) Prev

func (node *Node) Prev() (int, *Node, error)

type RenderContext

type RenderContext map[string]any

type RenderResponse added in v0.1.1

type RenderResponse struct {
	Pass     bool
	Skip     bool
	Rendered bool
	Error    error
}

Jump to

Keyboard shortcuts

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