Skip to content

Instantly share code, notes, and snippets.

@micha
Last active January 5, 2019 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micha/94b71e148e40c412141cb651b8bc2583 to your computer and use it in GitHub Desktop.
Save micha/94b71e148e40c412141cb651b8bc2583 to your computer and use it in GitHub Desktop.
(let [fig (figure)
cap (figcaption)]
(fig (img :src "http://example.com")
(cap "hello world")))
;;;;;
(defelem fancy-list
[_ [& items]]
(div
:class "fancy-list"
(div
:class "fancy-list-items"
(ul (map (li :class "fancy-list-item") items)))))
;;;
(html
(body
(fancy-list
(p "mow the lawn")
(p (span "take out the ") (code "garbage"))
(img :src "http://foop.com"))))
;;;
(defc items
["mow the lawn"
"take out garbage"
"enjoy lolcats"])
(html
(body
(fancy-list
(for-tpl [item items]
(p item)))))
;;;
(defc items
["take out garbage"
"enjoy lolcats"])
(let [mylist (fancy-list (p "mow the lawn"))]
(html
(body
(mylist
(for-tpl [item items]
(p item))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment