htm

package
v0.0.0-...-4accd01 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, w io.Writer, frag Fragment) error

func WalkTree

func WalkTree(ctx context.Context, frag Fragment) error

func WriteTree

func WriteTree(w io.Writer, tree Node) error

Types

type Class

type Class string

func (Class) Children

func (Class) Children(ctx context.Context) ([]Fragment, error)

Children implements Fragment.

func (Class) Render

func (c Class) Render(ctx context.Context, parent Node) error

Render implements Fragment.

type DynamicFunc

type DynamicFunc func(ctx context.Context) ([]Fragment, error)

type Fragment

type Fragment interface {
	Children(ctx context.Context) ([]Fragment, error)
	Render(ctx context.Context, parent Node) error
}

func Attr

func Attr(key string, value string) Fragment

func Dynamic

func Dynamic(handler DynamicFunc) Fragment

func NewHtmlFragment

func NewHtmlFragment(tag string, children ...Fragment) Fragment

type Group

type Group []Fragment

func (Group) Children

func (g Group) Children(ctx context.Context) ([]Fragment, error)

Children implements Fragment.

func (Group) Render

func (g Group) Render(ctx context.Context, parent Node) error

Render implements Fragment.

type Node

type Node interface {
	AddClass(class string) error
	AddChild(node Node) error
	AddAttribute(key string, value string) error
	UnsafeAddRawHTML(content []byte) error
}

func RenderTree

func RenderTree(ctx context.Context, frag Fragment) (Node, error)

type Text

type Text string

func (Text) Children

func (Text) Children(ctx context.Context) ([]Fragment, error)

func (Text) Render

func (t Text) Render(ctx context.Context, parent Node) error

Render implements Fragment.

type UnsafeRawHTML

type UnsafeRawHTML []byte

func (UnsafeRawHTML) Children

func (UnsafeRawHTML) Children(ctx context.Context) ([]Fragment, error)

Children implements Fragment.

func (UnsafeRawHTML) Render

func (u UnsafeRawHTML) Render(ctx context.Context, parent Node) error

Render implements Fragment.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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