htmlbind

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package htmlbind parses typed HTML template sources into an AST.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(filename string, source []byte, options GenerateOptions) ([]byte, error)

Generate parses, validates, and compiles an HTML template module to Go.

Types

type Attribute

type Attribute struct {
	Kind    string          `json:"kind"`
	Pos     Position        `json:"pos"`
	Name    string          `json:"name"`
	Boolean bool            `json:"boolean,omitempty"`
	Value   []AttributePart `json:"value,omitempty"`
}

type AttributePart

type AttributePart struct {
	Kind       string   `json:"kind"`
	Pos        Position `json:"pos"`
	Context    string   `json:"context,omitempty"`
	Text       string   `json:"text,omitempty"`
	Expression Expr     `json:"expression,omitempty"`
}

type BinaryExpr

type BinaryExpr = syntax.BinaryExpr

type Body

type Body = []Node

Body is the body stored in TemplateDecl.Body.

type CallExpr

type CallExpr = syntax.CallExpr

type CommentNode

type CommentNode struct {
	Kind string   `json:"kind"`
	Pos  Position `json:"pos"`
	Text string   `json:"text"`
}

func (*CommentNode) NodeType

func (n *CommentNode) NodeType() string

type CompileError

type CompileError struct {
	Filename string
	Pos      Position
	Message  string
}

func (*CompileError) Error

func (e *CompileError) Error() string

type ComponentNode

type ComponentNode struct {
	Kind        string      `json:"kind"`
	Pos         Position    `json:"pos"`
	Name        string      `json:"name"`
	Arguments   []Attribute `json:"arguments,omitempty"`
	Children    []Node      `json:"children,omitempty"`
	SelfClosing bool        `json:"selfClosing,omitempty"`
}

func (*ComponentNode) NodeType

func (n *ComponentNode) NodeType() string

type ConditionalExpr

type ConditionalExpr = syntax.ConditionalExpr

type Declaration

type Declaration = syntax.Declaration

type DoctypeNode

type DoctypeNode struct {
	Kind string   `json:"kind"`
	Pos  Position `json:"pos"`
	Text string   `json:"text"`
}

func (*DoctypeNode) NodeType

func (n *DoctypeNode) NodeType() string

type ElementNode

type ElementNode struct {
	Kind        string      `json:"kind"`
	Pos         Position    `json:"pos"`
	Name        string      `json:"name"`
	Attributes  []Attribute `json:"attributes,omitempty"`
	Children    []Node      `json:"children,omitempty"`
	SelfClosing bool        `json:"selfClosing,omitempty"`
}

func (*ElementNode) NodeType

func (n *ElementNode) NodeType() string

type EnumDecl

type EnumDecl = syntax.EnumDecl

type EnumMember

type EnumMember = syntax.EnumMember

type Expr

type Expr = syntax.Expr

type ExpressionNode

type ExpressionNode = syntax.ExpressionNode

type ExternalDecl

type ExternalDecl = syntax.ExternalDecl

type Field

type Field = syntax.Field

type ForNode

type ForNode = syntax.ForNode

type GenerateOptions

type GenerateOptions struct {
	// Package overrides the template package/module declaration.
	Package string
}

GenerateOptions controls the generated Go file.

type IdentifierExpr

type IdentifierExpr = syntax.IdentifierExpr

type IfNode

type IfNode = syntax.IfNode

type ImportDecl

type ImportDecl = syntax.ImportDecl

type IndexExpr

type IndexExpr = syntax.IndexExpr

type LiteralExpr

type LiteralExpr = syntax.LiteralExpr

type MemberExpr

type MemberExpr = syntax.MemberExpr

type Module

type Module = syntax.Module

func Parse

func Parse(filename string, source []byte) (*Module, error)

Parse parses one template source using the shared declarations and the HTML component root declaration.

type Node

type Node = syntax.Node

type PackageDecl

type PackageDecl = syntax.PackageDecl

type Parameter

type Parameter = syntax.Parameter

type ParseError

type ParseError = syntax.ParseError

type Position

type Position = syntax.Position

type TemplateDecl

type TemplateDecl = syntax.TemplateDecl

type TextNode

type TextNode struct {
	Kind string   `json:"kind"`
	Pos  Position `json:"pos"`
	Text string   `json:"text"`
}

func (*TextNode) NodeType

func (n *TextNode) NodeType() string

type TypeDecl

type TypeDecl = syntax.TypeDecl

type TypeRef

type TypeRef = syntax.TypeRef

type UnaryExpr

type UnaryExpr = syntax.UnaryExpr

Jump to

Keyboard shortcuts

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