rhtml

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package rhtml provides Runa's enhanced HTML template renderer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Props

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

Props contains explicit custom tag attributes.

func (Props) Bool

func (props Props) Bool(name string) bool

Bool returns one prop as bool.

func (Props) Get

func (props Props) Get(name string) any

Get returns one prop value.

func (Props) Int

func (props Props) Int(name string) int

Int returns one prop as int.

func (Props) Map

func (props Props) Map() map[string]any

Map returns a cloned prop map.

func (Props) Root

func (props Props) Root() any

Root returns the original render data.

func (Props) String

func (props Props) String(name string) string

String returns one prop as string.

type Renderer

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

Renderer compiles rhtml tags to html/template and renders templates.

func New

func New(sources ...view.Source) *Renderer

New creates an enhanced HTML renderer that can also be used directly.

func (*Renderer) Func

func (renderer *Renderer) Func(name string, fn any) *Renderer

Func registers a template function.

func (*Renderer) Funcs

func (renderer *Renderer) Funcs(funcs template.FuncMap) *Renderer

Funcs registers template functions.

func (*Renderer) Load

func (renderer *Renderer) Load(ctx context.Context, set *view.Set) error

Load scans sources, compiles rhtml tags, and parses templates.

func (*Renderer) Render

func (renderer *Renderer) Render(ctx view.Context, writer io.Writer, name string, data any) error

Render renders one compiled template by name.

func (*Renderer) Tag

func (renderer *Renderer) Tag(name string, handler TagHandler) *Renderer

Tag registers a custom r: tag.

func (*Renderer) ViewSet

func (renderer *Renderer) ViewSet() view.Set

ViewSet exposes renderer sources to the view registry.

type TagHandler

type TagHandler func(context.Context, Props) (any, error)

TagHandler resolves custom r: tag data.

Jump to

Keyboard shortcuts

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