Warning: This module uses immediate macros which are known to cause problems. Do yourself a favor and import the module as from htmlgen import nil and then fully qualify the macros.
This module implements a simple XML and HTML code generator. Each commonly used HTML tag has a corresponding macro that generates a string with its HTML representation.
Example:
var nim = "Nim" echo h1(a(href="http://nim-lang.org", nim))
Writes the string:
<h1><a href="http://nim-lang.org">Nim</a></h1>
Consts
coreAttr = " id class title style "
- Source Edit
eventAttr = " onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup onload "
- Source Edit
commonAttr = " id class title style onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup onload "
- Source Edit
Macros
macro a(e: expr): expr {.
immediate.}- generates the HTML a element. Source Edit
macro acronym(e: expr): expr {.
immediate.}- generates the HTML acronym element. Source Edit
macro address(e: expr): expr {.
immediate.}- generates the HTML address element. Source Edit
macro area(e: expr): expr {.
immediate.}- generates the HTML area element. Source Edit
macro b(e: expr): expr {.
immediate.}- generates the HTML b element. Source Edit
macro base(e: expr): expr {.
immediate.}- generates the HTML base element. Source Edit
macro big(e: expr): expr {.
immediate.}- generates the HTML big element. Source Edit
macro blockquote(e: expr): expr {.
immediate.}- generates the HTML blockquote element. Source Edit
macro body(e: expr): expr {.
immediate.}- generates the HTML body element. Source Edit
macro br(e: expr): expr {.
immediate.}- generates the HTML br element. Source Edit
- generates the HTML button element. Source Edit
macro caption(e: expr): expr {.
immediate.}- generates the HTML caption element. Source Edit
macro cite(e: expr): expr {.
immediate.}- generates the HTML cite element. Source Edit
macro code(e: expr): expr {.
immediate.}- generates the HTML code element. Source Edit
macro col(e: expr): expr {.
immediate.}- generates the HTML col element. Source Edit
macro colgroup(e: expr): expr {.
immediate.}- generates the HTML colgroup element. Source Edit
macro dd(e: expr): expr {.
immediate.}- generates the HTML dd element. Source Edit
macro del(e: expr): expr {.
immediate.}- generates the HTML del element. Source Edit
macro dfn(e: expr): expr {.
immediate.}- generates the HTML dfn element. Source Edit
macro `div`(e: expr): expr {.
immediate.}- generates the HTML div element. Source Edit
macro dl(e: expr): expr {.
immediate.}- generates the HTML dl element. Source Edit
macro dt(e: expr): expr {.
immediate.}- generates the HTML dt element. Source Edit
macro em(e: expr): expr {.
immediate.}- generates the HTML em element. Source Edit
macro fieldset(e: expr): expr {.
immediate.}- generates the HTML fieldset element. Source Edit
macro form(e: expr): expr {.
immediate.}- generates the HTML form element. Source Edit
macro h1(e: expr): expr {.
immediate.}- generates the HTML h1 element. Source Edit
macro h2(e: expr): expr {.
immediate.}- generates the HTML h2 element. Source Edit
macro h3(e: expr): expr {.
immediate.}- generates the HTML h3 element. Source Edit
macro h4(e: expr): expr {.
immediate.}- generates the HTML h4 element. Source Edit
macro h5(e: expr): expr {.
immediate.}- generates the HTML h5 element. Source Edit
macro h6(e: expr): expr {.
immediate.}- generates the HTML h6 element. Source Edit
macro head(e: expr): expr {.
immediate.}- generates the HTML head element. Source Edit
macro html(e: expr): expr {.
immediate.}- generates the HTML html element. Source Edit
macro hr(): expr {.
immediate.}- generates the HTML hr element. Source Edit
macro i(e: expr): expr {.
immediate.}- generates the HTML i element. Source Edit
macro img(e: expr): expr {.
immediate.}- generates the HTML img element. Source Edit
macro input(e: expr): expr {.
immediate.}- generates the HTML input element. Source Edit
macro ins(e: expr): expr {.
immediate.}- generates the HTML ins element. Source Edit
macro kbd(e: expr): expr {.
immediate.}- generates the HTML kbd element. Source Edit
macro label(e: expr): expr {.
immediate.}- generates the HTML label element. Source Edit
macro legend(e: expr): expr {.
immediate.}- generates the HTML legend element. Source Edit
macro li(e: expr): expr {.
immediate.}- generates the HTML li element. Source Edit
macro link(e: expr): expr {.
immediate.}- generates the HTML link element. Source Edit
macro map(e: expr): expr {.
immediate.}- generates the HTML map element. Source Edit
macro meta(e: expr): expr {.
immediate.}- generates the HTML meta element. Source Edit
macro noscript(e: expr): expr {.
immediate.}- generates the HTML noscript element. Source Edit
macro `object`(e: expr): expr {.
immediate.}- generates the HTML object element. Source Edit
macro ol(e: expr): expr {.
immediate.}- generates the HTML ol element. Source Edit
macro optgroup(e: expr): expr {.
immediate.}- generates the HTML optgroup element. Source Edit
macro option(e: expr): expr {.
immediate.}- generates the HTML option element. Source Edit
macro p(e: expr): expr {.
immediate.}- generates the HTML p element. Source Edit
macro param(e: expr): expr {.
immediate.}- generates the HTML param element. Source Edit
macro pre(e: expr): expr {.
immediate.}- generates the HTML pre element. Source Edit
macro q(e: expr): expr {.
immediate.}- generates the HTML q element. Source Edit
macro samp(e: expr): expr {.
immediate.}- generates the HTML samp element. Source Edit
macro script(e: expr): expr {.
immediate.}- generates the HTML script element. Source Edit
macro select(e: expr): expr {.
immediate.}- generates the HTML select element. Source Edit
macro small(e: expr): expr {.
immediate.}- generates the HTML small element. Source Edit
macro span(e: expr): expr {.
immediate.}- generates the HTML span element. Source Edit
macro strong(e: expr): expr {.
immediate.}- generates the HTML strong element. Source Edit
macro style(e: expr): expr {.
immediate.}- generates the HTML style element. Source Edit
macro sub(e: expr): expr {.
immediate.}- generates the HTML sub element. Source Edit
macro sup(e: expr): expr {.
immediate.}- generates the HTML sup element. Source Edit
macro table(e: expr): expr {.
immediate.}- generates the HTML table element. Source Edit
macro tbody(e: expr): expr {.
immediate.}- generates the HTML tbody element. Source Edit
macro td(e: expr): expr {.
immediate.}- generates the HTML td element. Source Edit
macro textarea(e: expr): expr {.
immediate.}- generates the HTML textarea element. Source Edit
macro tfoot(e: expr): expr {.
immediate.}- generates the HTML tfoot element. Source Edit
macro th(e: expr): expr {.
immediate.}- generates the HTML th element. Source Edit
macro thead(e: expr): expr {.
immediate.}- generates the HTML thead element. Source Edit
macro title(e: expr): expr {.
immediate.}- generates the HTML title element. Source Edit
macro tr(e: expr): expr {.
immediate.}- generates the HTML tr element. Source Edit
macro tt(e: expr): expr {.
immediate.}- generates the HTML tt element. Source Edit
macro ul(e: expr): expr {.
immediate.}- generates the HTML ul element. Source Edit
macro `var`(e: expr): expr {.
immediate.}- generates the HTML var element. Source Edit