Documentation ¶
Overview ¶
Build markup documents from simple objects.
Index ¶
- Constants
- func Expect(t *testing.T, expected interface{}, actual interface{})
- func IDString(s string) string
- func QuoteString(s string) string
- type Attributes
- type ContentNode
- type Document
- type Element
- func (el *Element) AddAttr(ks ...string) *Element
- func (el *Element) AddChild(c ...Node) *Element
- func (el *Element) AddClass(class string) *Element
- func (el *Element) Attr(k string) string
- func (el *Element) ChildN(n int) Node
- func (el *Element) Children() []Node
- func (el *Element) Copy() *Element
- func (el *Element) Format() *Format
- func (el *Element) HasClass(class string) bool
- func (el *Element) ID() string
- func (el *Element) SetAttr(k string, v string) *Element
- func (el *Element) SetAttrs(kvs map[string]string) *Element
- func (el *Element) SetFormat(fmt *Format)
- func (el *Element) SetID(id string) *Element
- func (el *Element) String() string
- func (el *Element) Tag() string
- type ElementOption
- type Format
- type Formatter
- type HTML5Document
- type Node
Constants ¶
View Source
const HTML5Doctype string = "<!DOCTYPE html>"
Variables ¶
This section is empty.
Functions ¶
func QuoteString ¶
Types ¶
type Attributes ¶
type ContentNode ¶
type ContentNode string
func Content ¶
func Content(s string) ContentNode
func (ContentNode) String ¶
func (s ContentNode) String() string
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
func NewElement ¶
func NewElement(tag string, opts ...ElementOption) *Element
type ElementOption ¶
type ElementOption func(el *Element)
func OptFormat ¶
func OptFormat(fmt *Format) ElementOption
type Format ¶
type Format struct { Close bool // Self closing Sep string // Separator Prefix string CPrefix string // Child Prefix TagFmt Formatter TagOpen string TagClose string EndTagOpen string EndTagClose string AttrSep string AttrKFmt Formatter AttrVFmt Formatter }
Format for the element.
type HTML5Document ¶
type HTML5Document struct { }
func (*HTML5Document) Doctype ¶
func (doc *HTML5Document) Doctype() string
Click to show internal directories.
Click to hide internal directories.