3 ms·
Really, I think Hiccup is the best solution in this space. Prefer logic-less functions to output html strings? Hiccup has this use case covered. This is all st
by escherize 11y ago
Really, I think Hiccup is the best solution in this space.
Prefer logic-less functions to output html strings? Hiccup has this use case covered. This is all stock Clojure[script], not a templating language:
(def foo [:h2 "something cool"])
(hiccup.core/html foo) ;;=> "<h2>something cool</h2>"
Plus there's plenty of ways to quickly build up a bootstrap (, etc) page.
(defn bootstrap-page [hiccup-form]
(hiccup.page/html5
(hiccup.page/include-js "link-to-jquery.js"
"link-to-bootstrap.js")
(hiccup.page/include-css "link-to-bootstrap.css")
hiccup-form))
BTW, there are some interactive examples at http://hiccup.space http://hiccup.space
- pflanze 11y agoI'm going a tiny step further with the XML/HTML generation solution in functional Perl [1]: provide actual functions to instantiate HTML (or defined XML) elements, instead of relying on arrays. That allows for passing them directly to higher-order functions like map (and it also gives elements a proper type). my $rows= list(list(1,2,3), list(4,5,6)); HTML(BODY(TABLE($rows->map(fun($row) { TR($row->map(*TD)) }))))->string # => '<html><body><table><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr></table></body></html>' ref HTML() # => 'PXML::PXHTML'; [1] http://functional-perl.org/ http://functional-perl.org/
- s_kilk 11y agoHiccup is wonderful, almost makes it painful to go back to jade/erb/jinja/etc after working on a project with hiccup.
- draegtun 11y agoCL-WHO is an often forgotten grandfather of Hiccup - http://weitz.de/cl-who/ http://weitz.de/cl-who/ Also here's a quick list of some other CL-WHO alternatives - http://stackoverflow.com/questions/671572/cl-who-like-html-templating-for-other-languages http://stackoverflow.com/questions/671572/cl-who-like-html-t...