html

package
v0.0.0-...-688b8c7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(
	title, description string, oobe bool, metadata any, statusCode int,
) http.HandlerFunc

Handler is used make a handler to serve an HTTP response to an existing connection.

func Render

func Render(title, description, publicUrl string, javascriptAssets []string, metadata any) (res []byte, err error)

Render is used to render the HTML to a byte slice or copy a cached version if it exists. Returns a byte slice.

func Setup

func Setup(isDev bool)

Setup is used to initialize the public variable. This should be called immediately at boot before any templating and then never called again!

Types

type Fragment

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

Fragment defines a thread safe fragment of HTML.

func NewBodyFragment

func NewBodyFragment(content string) *Fragment

NewBodyFragment is used to make a new thread safe HTML body element that can be get/set. This will update what is in the additional part of the head.

func NewHeadFragment

func NewHeadFragment(content string) *Fragment

NewHeadFragment is used to make a new thread safe HTML head element that can be get/set. This will update what is in the additional part of the head.

func (*Fragment) Get

func (f *Fragment) Get() string

Get is used to get the contents of a fragment.

func (*Fragment) Write

func (f *Fragment) Write(val string)

Write is used to write a value and trigger a rewrite of whatever fragment chain this belongs to.

Jump to

Keyboard shortcuts

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