README
HDML
Table of Contents generated with DocToc
HDML
HDML is a very simplistic HTML tag generation library for NodeJS
API
escape_text: ( text ) ->
—Escapetext
for use in HTML (by turning all occurrences of<
,>
, and&
into<
,>
, and&
, respectively).atr_value_as_text: ( x ) ->
—Turnx
into a string (if it is not a string already) and escape it for use in an HTML attribute value (applyingescape_text()
and then replace all occurrences of single quotation mark and nesline characters by'
and
, respectively).create_tag: ( sigil, tag, atrs = null ) ->
—Given asigil
to mark the role of the tag, a tagname, and an optional attributes object, return a HTML tag literal.create_opening_tag: ( tag, atrs = null ) ->
—Create an opening tag like<div atr='value'>
.create_selfclosing_tag: ( tag, atrs = null ) ->
—Create an self-closing tag like<path atr='value'/>
(not used in HTML5 but in SVG).create_closing_tag: ( tag ) ->
—Create a closing tag like</div>
.
Notes
All tag names will be written as passed-in; this may result in illegal tag names. This may change in the future.
All attributes are always written with single quotes.