webgen

package
v0.0.0-...-fe628ba Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const HTMLDocString = "<!doctype html>"

HTMLDocString is the doc type string for HTML.

Variables

View Source
var (
	HTML = bind(atom.Html)

	Head  = bind(atom.Head)
	Title = bind(atom.Title)
	Meta  = bind(atom.Meta)
	Link  = bind(atom.Link)

	Body = bind(atom.Body)
	Div  = bind(atom.Div)
	Span = bind(atom.Span)

	P          = bind(atom.P)
	Pre        = bind(atom.Pre)
	Blockquote = bind(atom.Blockquote)
	Strong     = bind(atom.Strong)
	Em         = bind(atom.Em)

	H1 = bind(atom.H1)
	H2 = bind(atom.H2)
	H3 = bind(atom.H3)
	H4 = bind(atom.H3)
	H5 = bind(atom.H3)
	H6 = bind(atom.H3)

	A = bind(atom.A)

	Ul = bind(atom.Ul)
	Ol = bind(atom.Ol)
	Li = bind(atom.Li)

	Br = bind(atom.Br)
)

Shorthand element creators.

Functions

func Render

func Render(w io.Writer, n *Node) error

Render renders a page with the given HTML

func RenderBody

func RenderBody(w io.Writer, page *Page, body *Node) error

RenderBody renders a page with the given Body

func RenderString

func RenderString(page *Page, body *Node) (string, error)

RenderString renders a page into a string.

func Template

func Template(p *Page, body *Node) (*template.Template, error)

Template makes an HTML template with the given body.

func TemplateBody

func TemplateBody(children ...interface{}) (*template.Template, error)

TemplateBody makes an HTML template with the given elements as the body.

Types

type Attrs

type Attrs map[string]string

Attrs is an attribute map.

type Class

type Class []string

Class is the class attribute for a div.

type Node

type Node struct{ *html.Node }

Node wraps around an html node.

func Element

func Element(n interface{}, children ...interface{}) *Node

Element create a new element.

func NewCSSLink(href string) *Node

NewCSSLink creates a new CSS link ini uh 6tg6fdb n bnnnnnnnnnnn<F6><F6>

func NewHTML

func NewHTML(lang string) *Node

NewHTML creates a new blank HTML element with the specified language.

func NewHTMLChinese

func NewHTMLChinese() *Node

NewHTMLChinese creates a new Chinese HTML element.

func NewHTMLEnglish

func NewHTMLEnglish() *Node

NewHTMLEnglish creates a new English HTML element.

func NewLink(href string, children ...interface{}) *Node

NewLink creates a new web link.

func NewMeta

func NewMeta(key, value string) *Node

NewMeta creates a new meta tag.

func Text

func Text(s string) *Node

Text creates a text node.

func (*Node) Add

func (n *Node) Add(children ...interface{}) error

Add appends more stuff into the node.

type Page

type Page struct {
	NoDocType bool
	Title     string
}

Page contains the configuration of a page.

Jump to

Keyboard shortcuts

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