Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating HTML with ClojureScript

I am trying to generate the following HTML fragment using clojure.browser.dom, however it looks like it works different than hiccup,

<div data-role="controlgroup">
<a href="index.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Maybe</a>
</div>

What is the correct notation for generating HTML element? Using,

[:div {:data-role "controlgroup"} ...]

does not generate,

<div data-role="controlgroup">
like image 691
Hamza Yerlikaya Avatar asked Dec 26 '22 17:12

Hamza Yerlikaya


2 Answers

Also have a look at dommy which is essentially an optimised version of crate (the cljs version of hiccup) that murtaza52 suggested.

like image 67
Adrian Mouat Avatar answered Dec 29 '22 05:12

Adrian Mouat


Have a look at crate - https://github.com/ibdknox/crate - it is a port of hiccup to cljs.

Also look at enfocus which is an implementation of enlive - https://github.com/cgrand/enlive

like image 44
murtaza52 Avatar answered Dec 29 '22 05:12

murtaza52