Documentation ¶
Overview ¶
Example ¶
package main import ( "html" "os" "gitlab.codemonkeysoftware.net/b/hatmill" ha "gitlab.codemonkeysoftware.net/b/hatmill/attribute" he "gitlab.codemonkeysoftware.net/b/hatmill/element" ) func main() { userInput := "<script>launchMissiles();</script>" document := he.Html()( he.Body()( he.Img(ha.Src("./photo.jpg"), ha.Contenteditable(true)), hatmill.Text(html.EscapeString(userInput)), he.Div(ha.Disabled(), ha.CustomData("coolness", "awesome"))(), he.Textarea(ha.Rows(25))(), he.Meter(ha.Min(-1.3), ha.Max(5.5e12))(), ), ) hatmill.WriteDocument(os.Stdout, document) }
Output: <!DOCTYPE html><html><body><img src='./photo.jpg' contenteditable='true'><script>launchMissiles();</script><div disabled data-coolness='awesome'></div><textarea rows='25'></textarea><meter min='-1.3' max='5.5E+12'></meter></body></html>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteDocument ¶
func WriteDocument(w io.Writer, root ParentElement) (n int64, err error)
WriteDocument writes an HTML5 doctype declaration, followed by root. root should probably be an <html> element.
Types ¶
type ParentElement ¶
type ParentElement struct { VoidElement Children []Term }
ParentElement represents an HTML element that can have children.
type Term ¶
Term represents a fragment of HTML markup, and is one of VoidElement, ParentElement, or Text.
type VoidElement ¶
VoidElement represents a void HTML element, that is one that cannot have children.
Click to show internal directories.
Click to hide internal directories.