meter

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<meter")
	TagClose = []byte("</meter>")

	AttrValue   = []byte(" value=\"")
	AttrMin     = []byte(" min=\"")
	AttrMax     = []byte(" max=\"")
	AttrLow     = []byte(" low=\"")
	AttrHigh    = []byte(" high=\"")
	AttrOptimum = []byte(" optimum=\"")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New Creates a new meter element with optional child nodes Example: meter.New() Renders: <meter></meter>

func RawText

func RawText(str string) *element

RawText Creates a new meter element with raw fallback text content. Uses text.RawText which is not HTML-escaped. Example: meter.RawText("<strong>6</strong> out of 10") Renders: <meter><strong>6</strong> out of 10</meter>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf Creates a new meter element with formatted raw fallback text content. Uses text.RawTextf which is not HTML-escaped. Example: meter.RawTextf("<strong>%d</strong> out of %d", current, total) Renders: <meter><strong>7</strong> out of 10</meter>

func Static

func Static(str string) *element

Static Creates a new meter element with static fallback text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: meter.Static("75%") Renders: <meter>75%</meter>

func Text

func Text(str string) *element

Text Creates a new meter element with fallback text content. Uses text.Text which HTML-escapes the output. Example: meter.Text("6 out of 10") Renders: <meter>6 out of 10</meter>

func Textf

func Textf(format string, args ...any) *element

Textf Creates a new meter element with formatted fallback text content. Uses text.Textf which HTML-escapes the output. Example: meter.Textf("%d out of %d", current, total) Renders: <meter>7 out of 10</meter>

func ValueMax

func ValueMax(value float64, max float64, nodes ...node.Node) *element

ValueMax Creates a new meter element with value and max attributes Example: meter.ValueMax(6, 10) Renders: <meter value="6" max="10"></meter>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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