ui

package
v0.1.149 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package ui provides HTML template rendering and cache version management for the application's user interface. It manages template initialization, cache busting, and page rendering functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeHash

func EscapeHash(s string) string

EscapeHash replaces all '#' characters with '%23' for use in safe URL query parameters. Exported for use in tests and template funcMap.

func GetCacheVersion

func GetCacheVersion() string

GetCacheVersion returns the current cache version (thread-safe).

func ParseTemplates

func ParseTemplates(templateFS fs.FS) (err error)

ParseTemplates parses all embedded HTML templates and the associated function map. It uses GetCacheVersion() for cache-busting in templates.

func RenderPage

func RenderPage(w io.Writer, name string, data any, partial bool) error

RenderPage renders a full HTML page by executing a named template within the base "layout" template. If partial is true, it renders only the "body" block for htmx partial updates.

func RenderTemplate

func RenderTemplate(w io.Writer, name string, data any) error

RenderTemplate renders a single, standalone template by name. It is used for partials or components that are not part of a full page layout.

func SetCacheVersion

func SetCacheVersion(version string)

SetCacheVersion updates the application-wide cache version. This should be called when config is loaded or updated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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