Skip to content

Instantly share code, notes, and snippets.

@rxacevedo
Created February 26, 2014 18:00
Show Gist options
  • Save rxacevedo/6186c9f21e4696eec57b to your computer and use it in GitHub Desktop.
Save rxacevedo/6186c9f21e4696eec57b to your computer and use it in GitHub Desktop.
HTML markup via hiccup in Clojure
; This
(html [:html
[:head
[:meta {:charset "utf-8"}]
[:title "Title"]]
[:body
[:header
[:h1 "H1 header!"]]
[:section
[:ul
(for [x (range 1 4)]
[:li (str "Item " x)])]]
[:footer]]])
; Generates this
; <html>
; <head>
; <meta charset="utf-8" />
; <title>Title</title>
; </head>
; <body>
; <header>
; <h1>H1 header!</h1>
; </header>
; <section>
; <ul>
; <li>Item 1</li>
; <li>Item 2</li>
; <li>Item 3</li>
; </ul>
; </section>
; <footer>
; </footer>
; </body>
; </html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment