Documentation ¶
Index ¶
- Constants
- Variables
- type AreaElement
- type Attributes
- type AudioElement
- type AudioPreload
- type BaseElement
- type BodyElement
- type BoldElement
- type BreakElement
- type ButtonElement
- type CSSData
- type CSSElement
- type CellElement
- func (cell *CellElement) Bg(color string) *CellElement
- func (cell *CellElement) Center() *CellElement
- func (cell *CellElement) Colspan(n int) *CellElement
- func (cell *CellElement) Fg(color string) *CellElement
- func (cell *CellElement) Left() *CellElement
- func (cell *CellElement) Right() *CellElement
- func (cell *CellElement) Rowspan(n int) *CellElement
- func (cell *CellElement) Write(tw *TagWriter)
- func (cell *CellElement) WriteContent(tw *TagWriter)
- type CheckboxElement
- type Class
- type Container
- type DivElement
- type Document
- func (doc *Document) AddCSS(css *CSSData)
- func (doc *Document) AddStyle(style *Style)
- func (doc *Document) Body() *BodyElement
- func (doc *Document) Head() *HeadElement
- func (doc *Document) IoRender(w io.Writer)
- func (doc *Document) Render(w http.ResponseWriter)
- func (doc *Document) Write(tw *TagWriter)
- func (doc *Document) WriteContent(tw *TagWriter)
- type Element
- type FormElement
- func (f *FormElement) AddValidation(script string) *FormElement
- func (f *FormElement) FormName() string
- func (f *FormElement) MethodPOST() *FormElement
- func (f *FormElement) NewTab() *FormElement
- func (f *FormElement) SetAction(action *URL) *FormElement
- func (f *FormElement) SetName(name string) *FormElement
- func (f *FormElement) SetTarget(target string) *FormElement
- func (f *FormElement) ValidateFilled(name string, msg string) *FormElement
- func (f *FormElement) Write(tw *TagWriter)
- type FormSelectElement
- type HeadElement
- type HeadingElement
- type HtmlTag
- type IFrameElement
- type IOReaderElement
- type ImageElement
- func (e *ImageElement) AddMap(m *MapElement) *ImageElement
- func (e *ImageElement) H(h int) *ImageElement
- func (e *ImageElement) Height(h int) *ImageElement
- func (e *ImageElement) W(w int) *ImageElement
- func (e *ImageElement) Width(w int) *ImageElement
- func (e *ImageElement) Write(tw *TagWriter)
- func (e *ImageElement) WriteContent(tw *TagWriter)
- type InputElement
- type ItalicElement
- type LabelElement
- type ListElement
- type ListItemElement
- type ListNumber
- type ListStyle
- type ListType
- type MapElement
- type MetaElement
- type MimeType
- type NonBreakingSpace
- type OptionElement
- type ParagraphElement
- type PreElement
- type RowElement
- func (row *RowElement) Cell(e Element) *CellElement
- func (row *RowElement) CellInt(value interface{}) *CellElement
- func (row *RowElement) CellInts(is ...int)
- func (row *RowElement) CellString(s string) *CellElement
- func (row *RowElement) CellStrings(ss ...string)
- func (row *RowElement) Cells(elements ...Element)
- func (row *RowElement) Write(tw *TagWriter)
- func (row *RowElement) WriteContent(tw *TagWriter)
- type ScriptElement
- type SourceElement
- type Style
- type StyleDef
- type StyleElement
- type TableElement
- type TagWriter
- type TextAreaElement
- type TextElement
- type Title
- type URL
- func (u *URL) AddQuery(k string, v interface{}) *URL
- func (u *URL) Clone() *URL
- func (u *URL) DelQuery(k string) *URL
- func (u *URL) GetQuery(k string) string
- func (u *URL) GetQueryInt(k string) (int, bool)
- func (u *URL) HasQuery(k string) bool
- func (u *URL) Link() string
- func (u *URL) SetApp(app string) *URL
- func (u *URL) SetName(name string) *URL
- func (u *URL) SetPage(page string) *URL
- func (u *URL) Write(tw *TagWriter)
- func (u *URL) WriteContent(tw *TagWriter)
- type Version
Constants ¶
const ( PreloadNone = AudioPreload("none") PreloadMetaData = AudioPreload("metadata") PreloadAuto = AudioPreload("auto") )
const ( HTML4 = Version(4) HTML5 = Version(5) )
const ( Description ListType = iota Ordered Unordered // list-style-type LIDisc = ListStyle("disc") LICircle = ListStyle("circle") LISquare = ListStyle("square") LINone = ListStyle("none") // type="i" LINumber = ListNumber("1") LIALPHA = ListNumber("A") LIalpha = ListNumber("a") LIROMAN = ListNumber("I") LIroman = ListNumber("i") )
const (
ColorRed = "red"
)
Variables ¶
var ( TagNone = HtmlTag{} // go:nofmt TagA = HtmlTag{Open: "<a>", Close: "</a>"} TagArea = HtmlTag{Open: "<area>", Close: ""} TagAudio = HtmlTag{Open: "<audio>", Close: "</audio>"} TagB = HtmlTag{Open: "<b>", Close: "</b>"} TagBody = HtmlTag{Open: "<body>", Close: "</body>"} TagBr = HtmlTag{Open: "<br>", Close: ""} TagButton = HtmlTag{Open: "<button>", Close: "</button>"} TagComment = HtmlTag{Open: "<!--", Close: "-->"} TagDd = HtmlTag{Open: "<dd>", Close: "</dd>"} TagDiv = HtmlTag{Open: "<div>", Close: "</div>"} TagDl = HtmlTag{Open: "<dl>", Close: "</dl>"} TagDt = HtmlTag{Open: "<dt>", Close: "</dt>"} TagForm = HtmlTag{Open: "<form>", Close: "</form>"} TagH1 = HtmlTag{Open: "<h1>", Close: "</h1>"} TagH2 = HtmlTag{Open: "<h2>", Close: "</h2>"} TagH3 = HtmlTag{Open: "<h3>", Close: "</h3>"} TagH4 = HtmlTag{Open: "<h4>", Close: "</h4>"} TagH5 = HtmlTag{Open: "<h5>", Close: "</h5>"} TagH6 = HtmlTag{Open: "<h6>", Close: "</h6>"} TagHead = HtmlTag{Open: "<head>", Close: "</head>"} TagHtml = HtmlTag{Open: "<html>", Close: "</html>"} TagI = HtmlTag{Open: "<i>", Close: "</i>"} TagIFrame = HtmlTag{Open: "<iframe>", Close: "</iframe>"} TagImg = HtmlTag{Open: "<img>", Close: ""} TagInput = HtmlTag{Open: "<input>", Close: ""} TagLabel = HtmlTag{Open: "<label>", Close: "</label>"} TagLi = HtmlTag{Open: "<li>", Close: "</li>"} TagMap = HtmlTag{Open: "<map>", Close: "</map>"} TagMeta = HtmlTag{Open: "<meta>", Close: ""} TagOl = HtmlTag{Open: "<ol>", Close: "</ol>"} TagOption = HtmlTag{Open: "<option>", Close: "</option>"} TagP = HtmlTag{Open: "<p>", Close: "</p>"} TagPre = HtmlTag{Open: "<pre>", Close: "</pre>"} TagScript = HtmlTag{Open: "<script>", Close: "</script>"} TagSelect = HtmlTag{Open: "<select>", Close: "</select>"} TagSource = HtmlTag{Open: "<source>", Close: ""} TagStyle = HtmlTag{Open: "<style>", Close: "</style>"} TagTable = HtmlTag{Open: "<table>", Close: "</table>"} TagTd = HtmlTag{Open: "<td>", Close: "</td>"} TagTextArea = HtmlTag{Open: "<textarea>", Close: "</textarea>"} TagTitle = HtmlTag{Open: "<title>", Close: "</title>"} TagTh = HtmlTag{Open: "<th>", Close: "</th>"} TagTr = HtmlTag{Open: "<tr>", Close: "</tr>"} TagUl = HtmlTag{Open: "<ul>", Close: "</ul>"} Newline = []byte("\n") )
var ( // go:nofmt Mimes = map[string]MimeType{ ".aac": {Description: "AAC audio", Mime: "audio/aac"}, ".abw": {Description: "AbiWord document", Mime: "application/x-abiword"}, ".arc": {Description: "Archive document (multiple files embedded)", Mime: "application/x-freearc"}, ".avi": {Description: "AVI: Audio Video Interleave", Mime: "video/x-msvideo"}, ".azw": {Description: "Amazon Kindle eBook format", Mime: "application/vnd.amazon.ebook"}, ".bin": {Description: "Any kind of binary data", Mime: "application/octet-stream"}, ".bmp": {Description: "Windows OS/2 Bitmap Graphics", Mime: "image/bmp"}, ".bz": {Description: "BZip archive", Mime: "application/x-bzip"}, ".bz2": {Description: "BZip2 archive", Mime: "application/x-bzip2"}, ".csh": {Description: "C-Shell script", Mime: "application/x-csh"}, ".css": {Description: "Cascading Style Sheets (CSS)", Mime: "text/css"}, ".csv": {Description: "Comma-separated values (CSV)", Mime: "text/csv"}, ".doc": {Description: "Microsoft Word", Mime: "application/msword"}, ".docx": {Description: "Microsoft Word (OpenXML)", Mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}, ".eot": {Description: "MS Embedded OpenType fonts", Mime: "application/vnd.ms-fontobject"}, ".epub": {Description: "Electronic publication (EPUB)", Mime: "application/epub+zip"}, ".gz": {Description: "GZip Compressed Archive", Mime: "application/gzip"}, ".gif": {Description: "Graphics Interchange Format (GIF)", Mime: "image/gif"}, ".htm": {Description: "HyperText Markup Language (HTML)", Mime: "text/html"}, ".html": {Description: "HyperText Markup Language (HTML)", Mime: "text/html"}, ".ico": {Description: "Icon format", Mime: "image/vnd.microsoft.icon"}, ".ics": {Description: "iCalendar format", Mime: "text/calendar"}, ".jar": {Description: "Java Archive (JAR)", Mime: "application/java-archive"}, ".jpeg": {Description: "JPEG images", Mime: "image/jpeg"}, ".jpg": {Description: "JPEG images", Mime: "image/jpeg"}, ".js": {Description: "JavaScript", Mime: "text/javascript, per the following specifications:"}, ".json": {Description: "JSON format", Mime: "application/json"}, ".jsonld": {Description: "JSON-LD format", Mime: "application/ld+json"}, ".midi": {Description: "Musical Instrument Digital Interface (MIDI)", Mime: "audio/midi audio/x-midi"}, ".mjs": {Description: "JavaScript module", Mime: "text/javascript"}, ".mp3": {Description: "MP3 audio", Mime: "audio/mpeg"}, ".cda": {Description: "CD audio", Mime: "application/x-cdf"}, ".mp4": {Description: "MP4 audio", Mime: "video/mp4"}, ".mpeg": {Description: "MPEG Video", Mime: "video/mpeg"}, ".mpkg": {Description: "Apple Installer Package", Mime: "application/vnd.apple.installer+xml"}, ".odp": {Description: "OpenDocument presentation document", Mime: "application/vnd.oasis.opendocument.presentation"}, ".ods": {Description: "OpenDocument spreadsheet document", Mime: "application/vnd.oasis.opendocument.spreadsheet"}, ".odt": {Description: "OpenDocument text document", Mime: "application/vnd.oasis.opendocument.text"}, ".oga": {Description: "OGG audio", Mime: "audio/ogg"}, ".ogv": {Description: "OGG video", Mime: "video/ogg"}, ".ogx": {Description: "OGG", Mime: "application/ogg"}, ".opus": {Description: "Opus audio", Mime: "audio/opus"}, ".otf": {Description: "OpenType font", Mime: "font/otf"}, ".png": {Description: "Portable Network Graphics", Mime: "image/png"}, ".pdf": {Description: "Adobe Portable Document Format (PDF)", Mime: "application/pdf"}, ".php": {Description: "Hypertext Preprocessor (Personal Home Page)", Mime: "application/x-httpd-php"}, ".ppt": {Description: "Microsoft PowerPoint", Mime: "application/vnd.ms-powerpoint"}, ".pptx": {Description: "Microsoft PowerPoint (OpenXML)", Mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation"}, ".rar": {Description: "RAR archive", Mime: "application/vnd.rar"}, ".rtf": {Description: "Rich Text Format (RTF)", Mime: "application/rtf"}, ".sh": {Description: "Bourne shell script", Mime: "application/x-sh"}, ".svg": {Description: "Scalable Vector Graphics (SVG)", Mime: "image/svg+xml"}, ".swf": {Description: "Small web format (SWF) or Adobe Flash document", Mime: "application/x-shockwave-flash"}, ".tar": {Description: "Tape Archive (TAR)", Mime: "application/x-tar"}, ".tif": {Description: "Tagged Image File Format (TIFF)", Mime: "image/tiff"}, ".tiff": {Description: "Tagged Image File Format (TIFF)", Mime: "image/tiff"}, ".ts": {Description: "MPEG transport stream", Mime: "video/mp2t"}, ".ttf": {Description: "TrueType Font", Mime: "font/ttf"}, ".txt": {Description: "Text, (generally ASCII or ISO 8859-n)", Mime: "text/plain"}, ".vsd": {Description: "Microsoft Visio", Mime: "application/vnd.visio"}, ".wav": {Description: "Waveform Audio Format", Mime: "audio/wav"}, ".weba": {Description: "WEBM audio", Mime: "audio/webm"}, ".webm": {Description: "WEBM video", Mime: "video/webm"}, ".webp": {Description: "WEBP image", Mime: "image/webp"}, ".woff": {Description: "Web Open Font Format (WOFF)", Mime: "font/woff"}, ".woff2": {Description: "Web Open Font Format (WOFF)", Mime: "font/woff2"}, ".xhtml": {Description: "XHTML", Mime: "application/xhtml+xml"}, ".xls": {Description: "Microsoft Excel", Mime: "application/vnd.ms-excel"}, ".xlsx": {Description: "Microsoft Excel (OpenXML)", Mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}, ".xml": {Description: "XML", Mime: "application/xml"}, ".xul": {Description: "XUL", Mime: "application/vnd.mozilla.xul+xml"}, ".zip": {Description: "ZIP archive", Mime: "application/zip"}, ".3gp": {Description: "3GPP audio/video container", Mime: "video/3gpp"}, ".7z": {Description: "7-zip archive", Mime: "application/x-7z-compressed"}, } )
Functions ¶
This section is empty.
Types ¶
type AreaElement ¶
type AreaElement struct {
Attributes
}
Area element
func (*AreaElement) Write ¶
func (e *AreaElement) Write(tw *TagWriter)
Write writes the HTML area tag
func (*AreaElement) WriteContent ¶
func (e *AreaElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML area data (there is none)
type Attributes ¶
type Attributes struct {
// contains filtered or unexported fields
}
Attributes is a contaner for element attributes, implements BaseElement
func (*Attributes) AddAttr ¶
func (a *Attributes) AddAttr(key string, value string)
AddAttr will all a key/value attribute to an element
func (*Attributes) AddClass ¶
func (a *Attributes) AddClass(c *Class)
func (*Attributes) AddClassName ¶
func (a *Attributes) AddClassName(className string)
func (*Attributes) GetAttr ¶
func (a *Attributes) GetAttr(key string) string
func (*Attributes) GetAttrs ¶
func (a *Attributes) GetAttrs() string
GetAttr will return a serialized list of attrs in the form of ` attr1="attr" attr2="attr"`
func (*Attributes) Style ¶
func (a *Attributes) Style(key string, value string)
StyleAttr will all a style key/value attribute to an element
type AudioElement ¶
type AudioElement struct {
Container
}
func Audio ¶
func Audio(src string) *AudioElement
func (*AudioElement) Controls ¶
func (e *AudioElement) Controls() *AudioElement
func (*AudioElement) Preload ¶
func (e *AudioElement) Preload(preload AudioPreload) *AudioElement
func (*AudioElement) Source ¶
func (e *AudioElement) Source(s *SourceElement) *AudioElement
func (*AudioElement) Unimplemented ¶
func (e *AudioElement) Unimplemented(text string) *AudioElement
func (*AudioElement) Write ¶
func (e *AudioElement) Write(tw *TagWriter)
type AudioPreload ¶
type AudioPreload string
type BaseElement ¶
type BaseElement interface { // AddAttr adds a key/value attribute to an Element AddAttr(key string, value string) GetAttr(key string) string Style(key string, value string) GetAttrs() string AddClass(c *Class) AddClassName(className string) }
BaseElement is an interface that all HTML Element tags inherit from that allows for attributes This is done so that all element implement attributes in a consistent way
type BodyElement ¶
type BodyElement struct {
Container
}
Head defines the HTML body element
func (*BodyElement) Write ¶
func (body *BodyElement) Write(tw *TagWriter)
Write writes the HTML body tag and body data
type BoldElement ¶
type BoldElement struct {
Container
}
func (*BoldElement) Write ¶
func (e *BoldElement) Write(tw *TagWriter)
Write writes the Bold contents
type BreakElement ¶
type BreakElement struct { Attributes // contains filtered or unexported fields }
func Br ¶
func Br(n ...int) *BreakElement
func (*BreakElement) Write ¶
func (br *BreakElement) Write(tw *TagWriter)
func (*BreakElement) WriteContent ¶
func (br *BreakElement) WriteContent(tw *TagWriter)
type ButtonElement ¶
type ButtonElement struct { Container // contains filtered or unexported fields }
func Button ¶
func Button(buttonText string) *ButtonElement
func (*ButtonElement) OnClick ¶
func (e *ButtonElement) OnClick(js string)
OnClick will add an onclick javascipt
func (*ButtonElement) Write ¶
func (e *ButtonElement) Write(tw *TagWriter)
func (*ButtonElement) WriteContent ¶
func (e *ButtonElement) WriteContent(tw *TagWriter)
type CSSData ¶
type CSSData struct { Attributes // contains filtered or unexported fields }
Style describes an individual CSS style, which contians a set of associations (element, class or id) and set of key/values which describe individual styles
func CSS ¶
NewStyle will create a Style object, identified by name. An optional list of StyleDef can be passed to add individual styles, or Add() can be called later The Style will need to be added to the Styles list to be rendered
func (*CSSData) WriteContent ¶
type CSSElement ¶
type CSSElement struct { Container // contains filtered or unexported fields }
type CellElement ¶
type CellElement struct { Attributes // contains filtered or unexported fields }
CellElement is the contaner for a table row
func (*CellElement) Bg ¶
func (cell *CellElement) Bg(color string) *CellElement
func (*CellElement) Center ¶
func (cell *CellElement) Center() *CellElement
func (*CellElement) Colspan ¶
func (cell *CellElement) Colspan(n int) *CellElement
func (*CellElement) Fg ¶
func (cell *CellElement) Fg(color string) *CellElement
func (*CellElement) Left ¶
func (cell *CellElement) Left() *CellElement
func (*CellElement) Right ¶
func (cell *CellElement) Right() *CellElement
func (*CellElement) Rowspan ¶
func (cell *CellElement) Rowspan(n int) *CellElement
func (*CellElement) Write ¶
func (cell *CellElement) Write(tw *TagWriter)
Write writes the HTML table row tag and row and column
func (*CellElement) WriteContent ¶
func (cell *CellElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML table row and column data
type CheckboxElement ¶
func Checkbox ¶
func Checkbox(name string, value string) *CheckboxElement
Checkbox will create a check box name=value use Checkbox.Label to add a string label or Checkbox.Add(element) to add a different kind of label
func (*CheckboxElement) Label ¶
func (e *CheckboxElement) Label(label string) *CheckboxElement
func (*CheckboxElement) SetChecked ¶
func (e *CheckboxElement) SetChecked(checked bool) *CheckboxElement
func (*CheckboxElement) Write ¶
func (e *CheckboxElement) Write(tw *TagWriter)
type Class ¶
type Class struct { // Name is the name of the Class Name string }
Class is an association between Styles and elements
type Container ¶
type Container struct { Attributes // contains filtered or unexported fields }
Container is a generic container of HTML elements, like div, body, etc...
func (*Container) AddJavaScript ¶
func (*Container) WriteContent ¶
WriteContent write all elements in the container
type DivElement ¶
type DivElement struct {
Container
}
DivElement is a container for the Div
func Center ¶
func Center(elements ...Element) *DivElement
Center creates a new Div that is centered. Optionally can take a list of elements to add to the div
func Div ¶
func Div(elements ...Element) *DivElement
Div creates a new Div. Optionally can take a list of elements to add to the div
func Error ¶
func Error(text string) *DivElement
func (*DivElement) Write ¶
func (div *DivElement) Write(tw *TagWriter)
Write writes the Div and Contents
type Document ¶
type Document struct { Attributes // contains filtered or unexported fields }
Document is the top Level HTML document
func NewDocument ¶
func NewDocument() *Document
NewDocument creates a new HTML Document container This is the top level method
func (*Document) Render ¶
func (doc *Document) Render(w http.ResponseWriter)
Render will write the HTML document to the supplied io.Writer
func (*Document) WriteContent ¶
Write writes the HTML head/styles/body
type Element ¶
type Element interface { BaseElement // Write the element using the TagWriter. Write(tw *TagWriter) // WriteContnt is called to write the conent of the (between the open and close tags) using the TagWriter WriteContent(tw *TagWriter) }
Element is an interface the implements an HTML element
type FormElement ¶
type FormElement struct {
Container
}
Form is the contaner for a form
func (*FormElement) AddValidation ¶
func (f *FormElement) AddValidation(script string) *FormElement
func (*FormElement) FormName ¶
func (f *FormElement) FormName() string
func (*FormElement) MethodPOST ¶
func (f *FormElement) MethodPOST() *FormElement
func (*FormElement) NewTab ¶
func (f *FormElement) NewTab() *FormElement
func (*FormElement) SetAction ¶
func (f *FormElement) SetAction(action *URL) *FormElement
func (*FormElement) SetName ¶
func (f *FormElement) SetName(name string) *FormElement
func (*FormElement) SetTarget ¶
func (f *FormElement) SetTarget(target string) *FormElement
func (*FormElement) ValidateFilled ¶
func (f *FormElement) ValidateFilled(name string, msg string) *FormElement
func (*FormElement) Write ¶
func (f *FormElement) Write(tw *TagWriter)
Write writes the HTML form tag and container data
type FormSelectElement ¶
type FormSelectElement struct { Attributes // contains filtered or unexported fields }
func FormSelect ¶
func FormSelect(name string) *FormSelectElement
func (*FormSelectElement) Option ¶
func (e *FormSelectElement) Option(display, value string) *OptionElement
func (*FormSelectElement) OptionInt ¶
func (e *FormSelectElement) OptionInt(display string, value interface{}) *OptionElement
func (*FormSelectElement) Write ¶
func (e *FormSelectElement) Write(tw *TagWriter)
func (*FormSelectElement) WriteContent ¶
func (e *FormSelectElement) WriteContent(tw *TagWriter)
type HeadElement ¶
type HeadElement struct { Container // contains filtered or unexported fields }
Head defines the HTML head element
func Head ¶
func Head() *HeadElement
func (*HeadElement) AddTitle ¶
func (head *HeadElement) AddTitle(title string)
AddTitle Adds a title to the Header
func (*HeadElement) GetTitle ¶
func (head *HeadElement) GetTitle() string
GetTitle will return the last title set
func (*HeadElement) Write ¶
func (head *HeadElement) Write(tw *TagWriter)
Write writes the HTML head tag and head data
type HeadingElement ¶
type HeadingElement struct { Attributes // contains filtered or unexported fields }
Table is the contaner for a table
func Heading ¶
func Heading(level int, e Element) *HeadingElement
func (*HeadingElement) Write ¶
func (h *HeadingElement) Write(tw *TagWriter)
func (*HeadingElement) WriteContent ¶
func (h *HeadingElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML table row and column data
type HtmlTag ¶
HtmlTag defines the open/close structure for the tag Attributes are automatically inserted before the > in open tag
type IFrameElement ¶
type IFrameElement struct {
Container
}
func IFrame ¶
func IFrame(elements ...Element) *IFrameElement
IFrame creates a new IFrame. Optionally can take a list of elements to add to the iframe
func (*IFrameElement) Write ¶
func (e *IFrameElement) Write(tw *TagWriter)
Write writes the IFrame and contents
type IOReaderElement ¶
type IOReaderElement struct { Attributes // contains filtered or unexported fields }
func IOReadCloser ¶
func IOReadCloser(r io.ReadCloser) *IOReaderElement
IoReaderCloser will add an io.ReadCloser element, and then close when done In most cases, data to be rendered is know ahead of time, but in the case of pre, it might be slow in coming, so alow the reader to fill in as it goes
func IOReader ¶
func IOReader(r io.Reader) *IOReaderElement
IoReader will add an io.Reader element In most cases, data to be rendered is know ahead of time, but in the case of pre, it might be slow in coming, so alow the reader to fill in as it goes
func (*IOReaderElement) Write ¶
func (e *IOReaderElement) Write(tw *TagWriter)
Write writes the HTML tag and html data
func (*IOReaderElement) WriteContent ¶
func (e *IOReaderElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML for the pre Will attempt to Flush the data one line at a time
type ImageElement ¶
type ImageElement struct {
Attributes
}
func Image ¶
func Image(src string) *ImageElement
func (*ImageElement) AddMap ¶
func (e *ImageElement) AddMap(m *MapElement) *ImageElement
func (*ImageElement) H ¶
func (e *ImageElement) H(h int) *ImageElement
func (*ImageElement) Height ¶
func (e *ImageElement) Height(h int) *ImageElement
func (*ImageElement) W ¶
func (e *ImageElement) W(w int) *ImageElement
func (*ImageElement) Width ¶
func (e *ImageElement) Width(w int) *ImageElement
func (*ImageElement) Write ¶
func (e *ImageElement) Write(tw *TagWriter)
func (*ImageElement) WriteContent ¶
func (e *ImageElement) WriteContent(tw *TagWriter)
type InputElement ¶
type InputElement struct { Attributes Name string }
func Hidden ¶
func Hidden(name string, value interface{}) *InputElement
func Submit ¶
func Submit(label string) *InputElement
func TextInput ¶
func TextInput(name string, size int) *InputElement
func (*InputElement) SetDefault ¶
func (i *InputElement) SetDefault(value string) *InputElement
func (*InputElement) SetDefaultInt ¶
func (i *InputElement) SetDefaultInt(value interface{}) *InputElement
func (*InputElement) SetName ¶
func (i *InputElement) SetName(name string) *InputElement
func (*InputElement) Write ¶
func (i *InputElement) Write(tw *TagWriter)
func (*InputElement) WriteContent ¶
func (i *InputElement) WriteContent(tw *TagWriter)
type ItalicElement ¶
type ItalicElement struct {
Container
}
func Italic ¶
func Italic(elements ...Element) *ItalicElement
Italic creates a new Italic Container (i)
func (*ItalicElement) Write ¶
func (e *ItalicElement) Write(tw *TagWriter)
Write writes the Italic Contents
type LabelElement ¶
type LabelElement struct { Attributes // contains filtered or unexported fields }
func Label ¶
func Label(label string) *LabelElement
func (*LabelElement) Write ¶
func (l *LabelElement) Write(tw *TagWriter)
func (*LabelElement) WriteContent ¶
func (l *LabelElement) WriteContent(tw *TagWriter)
type ListElement ¶
type ListElement struct { Attributes // contains filtered or unexported fields }
Table is the contaner for a table
func (*ListElement) AddItem ¶
func (l *ListElement) AddItem(e Element) *ListItemElement
ListElement adds an element to the List
func (*ListElement) SetListSytle ¶
func (li *ListElement) SetListSytle(style ListStyle)
func (*ListElement) SetStart ¶
func (li *ListElement) SetStart(start int, numbering ListNumber)
func (*ListElement) Write ¶
func (l *ListElement) Write(tw *TagWriter)
Write writes the HTML list tag and table data
func (*ListElement) WriteContent ¶
func (l *ListElement) WriteContent(tw *TagWriter)
WriteContent writes the list elements
type ListItemElement ¶
type ListItemElement struct { Attributes // contains filtered or unexported fields }
ListItemElement is the contaner for a list item <li>
func (*ListItemElement) AddDescription ¶
func (li *ListItemElement) AddDescription(e Element)
func (*ListItemElement) Write ¶
func (li *ListItemElement) Write(tw *TagWriter)
Write writes the HTML table row tag and row and column
func (*ListItemElement) WriteContent ¶
func (li *ListItemElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML table row and column data
type ListNumber ¶
type ListNumber string
type MapElement ¶
type MapElement struct { Attributes // contains filtered or unexported fields }
MapElement is the contaner for area elements
func (*MapElement) Circle ¶
func (e *MapElement) Circle(href string, coords string) *AreaElement
Rect adds a Cicrle Area element to the map
func (*MapElement) Poly ¶
func (e *MapElement) Poly(href string, coords string) *AreaElement
Rect adds a Polygon Area element to the map
func (*MapElement) Rect ¶
func (e *MapElement) Rect(href string, coords string) *AreaElement
Rect adds a Rectangle Area element to the map
func (*MapElement) Write ¶
func (e *MapElement) Write(tw *TagWriter)
Write writes the HTML list tag and table data
func (*MapElement) WriteContent ¶
func (e *MapElement) WriteContent(tw *TagWriter)
WriteContent writes the list elements
type MetaElement ¶
type MetaElement struct { Attributes // contains filtered or unexported fields }
func MetaRefresh ¶
func MetaRefresh(seconds int, link string) *MetaElement
MetaRefresh will create a meta tag forcing a refresh in number of seconds. Link is optional
func (*MetaElement) Write ¶
func (m *MetaElement) Write(tw *TagWriter)
func (*MetaElement) WriteContent ¶
func (m *MetaElement) WriteContent(tw *TagWriter)
type NonBreakingSpace ¶
type NonBreakingSpace struct { Attributes // does not implement // contains filtered or unexported fields }
func Nbsp ¶
func Nbsp(n ...int) *NonBreakingSpace
func (*NonBreakingSpace) Write ¶
func (nbsp *NonBreakingSpace) Write(tw *TagWriter)
func (*NonBreakingSpace) WriteContent ¶
func (nbsp *NonBreakingSpace) WriteContent(tw *TagWriter)
type OptionElement ¶
type OptionElement struct { Attributes // contains filtered or unexported fields }
func (*OptionElement) Selected ¶
func (e *OptionElement) Selected(b ...bool) *OptionElement
func (*OptionElement) Write ¶
func (e *OptionElement) Write(tw *TagWriter)
func (*OptionElement) WriteContent ¶
func (e *OptionElement) WriteContent(tw *TagWriter)
type ParagraphElement ¶
type ParagraphElement struct {
Container
}
func Paragraph ¶
func Paragraph(elements ...Element) *ParagraphElement
Paragraph creates a new pargraph (p)
func (*ParagraphElement) Write ¶
func (e *ParagraphElement) Write(tw *TagWriter)
Write writes the Div and Contents
type PreElement ¶
type PreElement struct {
Container
}
func Pre ¶
func Pre(elements ...Element) *PreElement
func (*PreElement) Write ¶
func (pre *PreElement) Write(tw *TagWriter)
Write writes the HTML tag and html data for the pre element
type RowElement ¶
type RowElement struct { Attributes // contains filtered or unexported fields }
RowElement is the contaner for a table row
func (*RowElement) Cell ¶
func (row *RowElement) Cell(e Element) *CellElement
Cell adds an element to the table
func (*RowElement) CellInt ¶
func (row *RowElement) CellInt(value interface{}) *CellElement
CellString adds an string element to the table
func (*RowElement) CellInts ¶
func (row *RowElement) CellInts(is ...int)
CellStrings adds an string element to the table
func (*RowElement) CellString ¶
func (row *RowElement) CellString(s string) *CellElement
CellString adds an string element to the table
func (*RowElement) CellStrings ¶
func (row *RowElement) CellStrings(ss ...string)
CellStrings adds an string element to the table
func (*RowElement) Cells ¶
func (row *RowElement) Cells(elements ...Element)
Cells adds multiple elements to the table
func (*RowElement) Write ¶
func (row *RowElement) Write(tw *TagWriter)
Write writes the HTML table row tag and row and column
func (*RowElement) WriteContent ¶
func (row *RowElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML table row and column data
type ScriptElement ¶
type ScriptElement struct {
Container
}
Head defines the HTML body element
func Script ¶
func Script(js string) *ScriptElement
func (*ScriptElement) Write ¶
func (s *ScriptElement) Write(tw *TagWriter)
Write writes the HTML body tag and body data
type SourceElement ¶
type SourceElement struct {
Attributes
}
func Source ¶
func Source(src string) *SourceElement
func (*SourceElement) Type ¶
func (e *SourceElement) Type(t string) *SourceElement
func (*SourceElement) Write ¶
func (e *SourceElement) Write(tw *TagWriter)
func (*SourceElement) WriteContent ¶
func (e *SourceElement) WriteContent(tw *TagWriter)
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style describes an individual CSS style, which contians a set of associations (element, class or id) and set of key/values which describe individual styles
type StyleDef ¶
type StyleDef struct { // Key is the key name Key string // Value is value for the key Value string }
StyleDef describes an individual style key: value;
func StyleBackgroundColor ¶
StyleBackgroundColor defines a background color
type StyleElement ¶
type StyleElement struct { Attributes // contains filtered or unexported fields }
StyleElement contains a map of styles
func NewStyles ¶
func NewStyles() *StyleElement
NewStyles will create a container to contain Style objects
func (*StyleElement) Add ¶
func (styles *StyleElement) Add(style *Style)
Add a Style to the Styles container
func (*StyleElement) WriteContent ¶
func (s *StyleElement) WriteContent(tw *TagWriter)
Write each style
type TableElement ¶
type TableElement struct { Attributes // contains filtered or unexported fields }
Table is the contaner for a table
func (*TableElement) Header ¶
func (table *TableElement) Header() *RowElement
NewTable returns a Table RowElement object
func (*TableElement) Row ¶
func (table *TableElement) Row() *RowElement
NewTable returns a Table RowElement object
func (*TableElement) Write ¶
func (table *TableElement) Write(tw *TagWriter)
Write writes the HTML table tag and table data
func (*TableElement) WriteContent ¶
func (table *TableElement) WriteContent(tw *TagWriter)
WriteContent writes the HTML table data
type TagWriter ¶
type TagWriter struct {
// contains filtered or unexported fields
}
TagWrite is the base struct for writing output it contains an io write which the HTML document is rendered into
func NewTagWriter ¶
func NewTagWriter(w http.ResponseWriter) *TagWriter
NewTagWriter creates a TagWrite to render into an io.Writer
func (*TagWriter) Comment ¶
func (tw *TagWriter) Comment(data ...interface{})
Comment will insert an HTML Comment into the stream
func (*TagWriter) WriteString ¶
WriteString writes a string to the io.Writer
type TextAreaElement ¶
type TextAreaElement struct { Attributes // contains filtered or unexported fields }
func (*TextAreaElement) SetDefault ¶
func (ta *TextAreaElement) SetDefault(value string) *TextAreaElement
func (*TextAreaElement) Write ¶
func (ta *TextAreaElement) Write(tw *TagWriter)
func (*TextAreaElement) WriteContent ¶
func (ta *TextAreaElement) WriteContent(tw *TagWriter)
type TextElement ¶
type TextElement struct { Attributes // contains filtered or unexported fields }
func Raw ¶
func Raw(text string) *TextElement
func Text ¶
func Text(text string) *TextElement
func (*TextElement) Write ¶
func (t *TextElement) Write(tw *TagWriter)
func (*TextElement) WriteContent ¶
func (t *TextElement) WriteContent(tw *TagWriter)
type Title ¶
type Title struct { Attributes Title string }
Head defines the HTML head title element
func (*Title) WriteContent ¶
WriteContent writes the HTML title
type URL ¶
type URL struct { Attributes Name string // Name or Element Element // Element Scheme string UserPass string Host string Port string App string Page string RawQuery string Query url.Values Anchor string }
func (*URL) WriteContent ¶
WriteContent writes the HTML title