Hi all,
I'm happy to release clj-html, an HTML compilation library.
clj-html tries to combine the functional interface and expressive
literal vector syntax of compojure's HTML library[1] with the
compilation model of cl-who[2]. The goal is to start with easy-to-read
and concise templates, process them aggressively at compile time, and
leave as little code as possible to execute at run-time.
For example:
(html
[:body
[:div#content
[:h1.greeting greeting]
[:p.message message]]]))
; expands to:
(let* [html-builder (StringBuilder.)]
(.append html-builder "<body><div id=\"content\"><h1 class=\"greeting
\">")
(if-let [content__148 greeting] (.append html-builder
content__148))
(.append html-builder "</h1><p class=\"message\">")
(if-let [content__148 message] (.append html-builder content__148))
(.append html-builder "</p></div></body>")
(.toString html-builder))
; evaluates to (with greeting bound to "Hello" and message to "from
clj-html"):
"<body><div id=\"content\"><h1 class=\"greeting\">Hello</h1><p class=
\"message\">from clj-html</p></div></body>"
If clj-html sounds interesting to you, please check out the github
page:
http://github.com/mmcgrana/clj-html/tree/master
I've been using clj-html on an internal project recently, but this is
still very much alpha software. Comments and suggestions are welcome.
- Mark
[1] http://github.com/weavejester/compojure/tree/master
[2] http://www.weitz.de/cl-who/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---