template

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockHeader is the header composition block name.
	BlockHeader = "header"
	// BlockMain is the main composition block name.
	BlockMain = "main"
	// BlockFooter is the footer composition block name.
	BlockFooter = "footer"
)

Variables

This section is empty.

Functions

func IsValidBlock

func IsValidBlock(name string) bool

IsValidBlock reports whether name is a known block.

func OrderedBlocks

func OrderedBlocks() []string

OrderedBlocks returns the canonical block order copy.

func SortByBlockOrder

func SortByBlockOrder(blocks []string) error

SortByBlockOrder sorts blocks in canonical block order.

func ValidateBlocks

func ValidateBlocks(input []string) error

ValidateBlocks validates that every name is a known block.

Types

type Composer

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

Composer stores HTML fragments grouped by page block.

func NewComposer

func NewComposer() *Composer

NewComposer returns a Composer initialized with known blocks.

func (*Composer) AddHTML

func (c *Composer) AddHTML(block string, fragment template.HTML) error

AddHTML appends a trusted HTML fragment to block.

func (*Composer) AddString

func (c *Composer) AddString(block string, fragment string) error

AddString escapes fragment and appends it to block.

func (*Composer) Fragments

func (c *Composer) Fragments(block string) ([]template.HTML, error)

Fragments returns a copy of block fragments.

Jump to

Keyboard shortcuts

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