Created
February 26, 2014 18:00
-
-
Save rxacevedo/6186c9f21e4696eec57b to your computer and use it in GitHub Desktop.
HTML markup via hiccup in Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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