htm

package
v0.0.0-...-b5bdda3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EncodeURIComponent = url.QueryEscape

Functions

func If

func If[T ~string | Result](cond bool, result T) T

func IfCall

func IfCall[T ~string | Result](cond bool, call func() T) T

func IfElse

func IfElse[T ~string | Result](cond bool, ifR T, elseR T) T

func IfElseCall

func IfElseCall[T ~string | Result](cond bool, ifCall func() T, elseCall func() T) T

Types

type Attr

type Attr string

func NewAttr

func NewAttr(attr ...string) Attr

NewAttr constructs an attribute portion of an element(tag) attr: can be a complete attribute(s) specified as-is, or an attribute name, in which case it must end with =, and be followed by attribute value in the next arg, e.g. attr("disabled", `rel="icon" id=""`, "href=", "/", "class=", "") => disabled rel="icon" id="" href="/" class=""

type Result

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

contains well-formed HTML fragment

func Append

func Append(collect Result, frags ...Result) Result

func AsIs

func AsIs(a ...string) Result

func JSStringEscape

func JSStringEscape(a string) Result

func Map

func Map[T any](a []T, f func(int) Result) Result

func NewElem

func NewElem(tag string, attr Attr, bodyEl ...Result) Result

func NewHTML

func NewHTML(cap int) Result

func Prepend

func Prepend(doctype string, html Result) Result

func See

func See(what ...any) Result

func Text

func Text(a string) Result

Used to output HTML text, encoding HTML reserved characters <>&"

func (Result) IsEmpty

func (c Result) IsEmpty() bool

func (Result) String

func (c Result) String() string

Jump to

Keyboard shortcuts

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