html

package
v0.0.0-...-ba7cdbd Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2014 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package html provides some basic data structures for declaring HTML elements using Go code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(s string) string

func Minify

func Minify(w io.Writer, r io.Reader) error

Minify removes insignificant whitespace from the given HTML. Please, keep in mind that this function could break your HTML if you're using embedded scripts or if you rely on automatical semicolon insertion, because multiple whitespaces (' ', '\n', '\t' and '\r') will be collapsed into a single ' ' character. Formatting inside pre and textarea tags is preserved.

func Unescape

func Unescape(s string) string

Types

type Attrs

type Attrs map[string]string

func (Attrs) Add

func (a Attrs) Add(key, value string)

func (Attrs) Remove

func (a Attrs) Remove(key, value string)

func (Attrs) WriteTo

func (a Attrs) WriteTo(w io.Writer) (int, error)

type Node

type Node struct {
	Type     Type
	Tag      string
	Attrs    Attrs
	Content  string
	Next     *Node
	Children *Node
	Open     bool
}

func A

func A(href, text string) *Node

func Abbr

func Abbr(title, text string) *Node

func Article

func Article(children ...*Node) *Node

func Aside

func Aside(children ...*Node) *Node

func B

func B(text string) *Node

func Blockquote

func Blockquote(text string) *Node

func Br

func Br() *Node

func Button

func Button(text string) *Node

func Caption

func Caption(text string) *Node

func Div

func Div(children ...*Node) *Node

func Em

func Em(text string) *Node

func P

func P(children ...*Node) *Node

func Small

func Small(text string) *Node

func Span

func Span(children ...*Node) *Node

func Text

func Text(text string) *Node

func (*Node) AddAttr

func (n *Node) AddAttr(name string, value interface{}) *Node

func (*Node) AddClass

func (n *Node) AddClass(cls string) *Node

func (*Node) Append

func (n *Node) Append(node *Node) *Node

func (*Node) AppendChild

func (n *Node) AppendChild(c *Node)

func (*Node) AppendTo

func (n *Node) AppendTo(node *Node) *Node

func (*Node) Attr

func (n *Node) Attr(name string) string

func (*Node) DelAttr

func (n *Node) DelAttr(name string) *Node

func (*Node) Disable

func (n *Node) Disable(name string) *Node

func (*Node) Enable

func (n *Node) Enable(name string) *Node

func (*Node) HTML

func (n *Node) HTML() template.HTML

func (*Node) LastChild

func (n *Node) LastChild() *Node

func (*Node) NChildren

func (n *Node) NChildren() int

func (*Node) Prepend

func (n *Node) Prepend(node *Node) *Node

func (*Node) PrependTo

func (n *Node) PrependTo(node *Node) *Node

func (*Node) RemoveAttr

func (n *Node) RemoveAttr(name string, value interface{}) *Node

func (*Node) RemoveClass

func (n *Node) RemoveClass(cls string) *Node

func (*Node) Render

func (n *Node) Render(buf *bytes.Buffer)

func (*Node) SetAttr

func (n *Node) SetAttr(name string, value interface{}) *Node

func (*Node) String

func (n *Node) String() string

func (*Node) WriteTo

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

type Type

type Type uint
const (
	TAG_NODE Type = iota
	TEXT_NODE
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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