Abstract {macro-html} is a DSL for generating HTML¹. It aims to be fast, modular, cachable and concise. It does so by defining each element as a macro which expands to code printing the respective HTML source. It also employs a readtable syntax for element attributes. {macro-html.widgets} is a collection of widget functions. Those functions utilize {macro-html} to print compound HTML elements such as lists, forms or even complete documents. The provided widgets are documented in [macro-html Widgets](widgets.html). + 1. [HTML5](http://www.w3.org/TR/html5/) > < Usage {macro-html} exports an _element macro_ for every valid HTML element as of HTML5. An element macro prints the respective HTML element including its attributes, child elements and text nodes to {*standard-output*}. Single element macros such as {br} take a _property list_ of attributes as their arguments, e.g. {(br :class "foo" ...)}. Regular tag macros such as {p} take an arbitrary number of children as arguments. The first argument can optionally be an attribute list, e.g. {(p '(:attributes :class "bar" ...) "foo" ...)}. In order to ease specifying attributes for regular element macros the readtable {macro-html:syntax} provides a specialized reader syntax, e.g. {(p \[:class "bar" ...\] "foo" ...)}. Every child form gets evaluated exactly once. If a form evaluates to a string or pathname it will be escaped and printed inside the element, otherwise its return value will be ignored. Element macros can be nested to produce compound HTML output. #code Example usage of {macro-html}.# (p [:class "foo" :id "bar"] "Hello, " (b "World") "!" (br :class "baz") (symbol-name 'list)) ▷
Hello, World
▷
LIST