Markup

spork-site 0.1.1

Use locally scoped $tag forms while components, conditions, data access, and iteration remain ordinary Spork.

markup only gives special meaning to lists headed by a $-prefixed symbol. Components, conditionals, calls, data access, and iteration remain ordinary Spork.

Namespace: refer element, fragment, and markup from spork-site.core; examples also use site as its alias.

(defn post-card [post]
  (markup
    ($article {:class "post"}
      ($h2 ($a {:href (:route post)} (:title post)))
      ($p (:summary post)))))

(defn homepage [posts]
  (markup
    ($main {:class ["content" nil]}
      ($h1 "Spork")
      (for [post posts]
        (post-card post)))))

The macro lowers to public element and fragment bindings, so refer those names with markup. A qualified macro call also works:

(site.markup
  ($spork-playground {:source "(+ 1 2)"}))