A very basic Hiccup like HTML printer.

html

Available since version 1.0 (view source)

VAR of type IPrinterFactory

A HTML printer factory. Currently there are no options.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(str (print-one html [:p :para "Lorem ipsum"]))
;;=> "<p class=\"para\">Lorem ipsum</p>"

(str (print-one html [:h1 'heading "Foo foo"]))
;;=> "<h1 id=\"heading\">Foo foo</h1>"

(str (print-one html [:a {:src "http://example.com"} "example"]))
;;=> "<a src=\"http://example.com\">example</a>"

(str (print html [[:div :container
                   [:div 'left
                    [:ul
                     [:li "foo"]
                     [:li "bar"]
                     [:li "baz"]]]
                   [:div 'main
                    [:p "Lorem ipsum dolor sit amet"]
                    [:p "consectetur adipiscing elit"]]]]))
;;=> "<div class=\"container\"><div id=\"left\"><ul><li>foo</li><li>bar</li><li>baz</li></ul></div><div id=\"main\"><p>Lorem ipsum dolor sit amet</p><p>consectetur adipiscing elit</p></div></div>"