danm v0.1.4 Danm.HtmlWriter
Provide helper functions to write html programatically into a chardata all functions in this module put more data in a chardata
Link to this section Summary
Functions
helper macro to maintain flow of the pipe operator
build a void-element, which is an element that should not have inner text. It may have attributes though. Don't call this unless you are making a custom element; use the element specific funcions instead.
build a non-void element, which is an element that may have inner text. It may also have attributes. Don't call this unless you are making a custom element; use the element specific funcionsinstead.
export the data in the correct order
Invoke the func with s. This is used to keep the pipe flowing
start with minimum boilerplate
This is basically Enum.reduce with first 2 argument switched
Just add some text
Link to this section Functions
a(s, inner, attrs \\ [])
helper macro to maintain flow of the pipe operator
body(s, inner, attrs \\ [])
br(s, attrs \\ [])
div(s, inner, attrs \\ [])
element(s, tag, attrs)
build a void-element, which is an element that should not have inner text. It may have attributes though. Don't call this unless you are making a custom element; use the element specific funcions instead.
tag is the tag name. attr are a keyword list of attrbutes, each can be a string, an list of strings, or nil
element(s, tag, text, attrs)
build a non-void element, which is an element that may have inner text. It may also have attributes. Don't call this unless you are making a custom element; use the element specific funcionsinstead.
tag is the tag name. inner can be nil, a string or a function with arity of 1 that build inner text attr are a keyword list of attrbutes, each can be a string, an list of strings, or nil
export(s)
export the data in the correct order
h1(s, inner, attrs \\ [])
h2(s, inner, attrs \\ [])
h3(s, inner, attrs \\ [])
h4(s, inner, attrs \\ [])
h5(s, inner, attrs \\ [])
h6(s, inner, attrs \\ [])
head(s, inner, attrs \\ [])
hr(s, attrs \\ [])
html(s, inner, attrs \\ [])
img(s, attrs \\ [])
invoke(s, func)
Invoke the func with s. This is used to keep the pipe flowing
li(s, inner, attrs \\ [])
link(s, attrs \\ [])
meta(s, attrs \\ [])
new_html()
start with minimum boilerplate
p(s, inner, attrs \\ [])
roll_in(s, enum, function)
This is basically Enum.reduce with first 2 argument switched
script(s, inner, attrs \\ [])
style(s, inner, attrs \\ [])
table(s, inner, attrs \\ [])
td(s, inner, attrs \\ [])
text(s, text)
Just add some text