Documentation
¶
Index ¶
Constants ¶
const DefaultIncrement = 1
const DefaultLevel = 0
const DefaultTab = " "
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReader ¶
type Fragment ¶
type Fragment struct {
// contains filtered or unexported fields
}
Fragment is the concrete type of the Views interface.
func NewFragment ¶
func NewFragment() *Fragment
NewViews allocates an empty views list to which move views can be added.
type Indent ¶
Indent represents indention at a given level.
func NewIndent ¶
func NewIndent() Indent
Returns an Indent value starting at level 0, with an increment of 0, and a tab of 2 spaces.
type Inserter ¶
type Inserter struct {
// contains filtered or unexported fields
}
func NewInserter ¶
func NewInserter(res Resolver, reader FileReader) Inserter
type Node ¶
type Node struct { Tag string Children []*Node Attributes []*Node Type Type Key string Value string CData string IsVoid bool }
Nodes represent the different parts of of Html as one type. A single Node can be one and only one of the following types: Textual, Element, or Attribute. In general a Textual node will not have children, but will have CData, Elements can have both children of type Text, Element, Attributes or Fragment, but cannot directly hold CData. Attributes have only Key and Value strings, and all other fields are empty or nil. Lastly, Fragments can have children of type Text and Element, while all other fields are empty or nil.
func (*Node) Add ¶
Add will collect and bucket the nodes into atts and children. Nodes of type Text or Element are added to children and Attribute type are added to the Atts slice. If the Node is not an Element then attributes will silently be ignored.
func (*Node) ToNode ¶
ToNode is implemented to conform to a component pattern of Nodes within Nodes, but additionally some other instance can pose as a View if they implement ToNode.
type Tag ¶
Tag is the starting point of an element.
var ( // Normal tags requiring closing tag. A Tag = El("a", false) Abbr Tag = El("abbr", false) Address Tag = El("address", false) Article Tag = El("article", false) Aside Tag = El("aside", false) Audio Tag = El("audio", false) B Tag = El("b", false) Bdi Tag = El("bdi", false) Bdo Tag = El("bdo", false) Blockquote Tag = El("blockquote", false) Body Tag = El("body", false) Button Tag = El("button", false) Canvas Tag = El("canvas", false) Caption Tag = El("caption", false) Cite Tag = El("cite", false) Code Tag = El("code", false) Colgroup Tag = El("colgroup", false) Data Tag = El("data", false) Datalist Tag = El("datalist", false) Dd Tag = El("dd", false) Del Tag = El("del", false) Dfn Tag = El("dfn", false) Div Tag = El("div", false) Dl Tag = El("dl", false) Dt Tag = El("dt", false) Em Tag = El("em", false) Fieldset Tag = El("fieldset", false) Figcaption Tag = El("figcaption", false) Figure Tag = El("figure", false) Form Tag = El("form", false) H1 Tag = El("h1", false) H2 Tag = El("h2", false) H3 Tag = El("h3", false) H4 Tag = El("h4", false) H5 Tag = El("h5", false) H6 Tag = El("h6", false) Head Tag = El("head", false) Header Tag = El("header", false) Html Tag = El("html", false) I Tag = El("i", false) Iframe Tag = El("iframe", false) Ins Tag = El("ins", false) Kbd Tag = El("kbd", false) Label Tag = El("label", false) Legend Tag = El("legend", false) Li Tag = El("li", false) Main Tag = El("main", false) Map Tag = El("map", false) Mark Tag = El("mark", false) Meter Tag = El("meter", false) Noscript Tag = El("noscript", false) Object Tag = El("object", false) Ol Tag = El("ol", false) Optgroup Tag = El("optgroup", false) Option Tag = El("option", false) Output Tag = El("output", false) P Tag = El("p", false) Pre Tag = El("pre", false) Progress Tag = El("progress", false) Q Tag = El("q", false) Rb Tag = El("rb", false) Rp Tag = El("rp", false) Rt Tag = El("rt", false) Rtc Tag = El("rtc", false) Ruby Tag = El("ruby", false) S Tag = El("s", false) Samp Tag = El("samp", false) Script Tag = El("script", false) Section Tag = El("section", false) Select Tag = El("select", false) Small Tag = El("small", false) Span Tag = El("span", false) Strong Tag = El("strong", false) Style Tag = El("style", false) Sub Tag = El("sub", false) Sup Tag = El("sup", false) Table Tag = El("table", false) Tbody Tag = El("tbody", false) Td Tag = El("td", false) Template Tag = El("template", false) Textarea Tag = El("textarea", false) Tfoot Tag = El("tfoot", false) Th Tag = El("th", false) Thead Tag = El("thead", false) Time Tag = El("time", false) Title Tag = El("title", false) Tr Tag = El("tr", false) U Tag = El("u", false) Ul Tag = El("ul", false) Var Tag = El("var", false) Video Tag = El("video", false) // Void elements that must be self closed. Area Tag = El("area", true) Base Tag = El("base", true) Br Tag = El("br", true) Col Tag = El("col", true) Embed Tag = El("embed", true) Hr Tag = El("hr", true) Img Tag = El("img", true) Input Tag = El("input", true) Keygen Tag = El("keygen", true) Link Tag = El("link", true) Meta Tag = El("meta", true) Param Tag = El("param", true) Source Tag = El("source", true) Track Tag = El("track", true) Wbr Tag = El("wbr", true) )
type ToNode ¶
type ToNode func() *Node
ToNode is an empty function that returns a rendered/completed Node.
type ToView ¶
type ToView func() View
ToView is the functional equivalent of Viewable, which allows an empty function returning a View to be a Viewable.
type Type ¶
type Type int
type View ¶
type View interface {
ToNode() *Node
}
View interface represents anything that can be turned into a Node via the ToNode() function.
func Def ¶
func Def(val interface{}, def interface{}) View
Def takes two values, should the first be unconvertible to a Viewable or a view it will then attempt to convert the second. Nil is not convertible so in cases where the first is nil, the second will be used if possible. Should they both be nil the View will be of an empty Text node.