Skip to content

Instantly share code, notes, and snippets.

@zhzhxtrrk
Created August 22, 2013 05:42
Show Gist options
  • Save zhzhxtrrk/6303571 to your computer and use it in GitHub Desktop.
Save zhzhxtrrk/6303571 to your computer and use it in GitHub Desktop.
hiccup template/partial util
(ns beta-shop.view-util
(:use hiccup.core))
(defmacro defpartial
[fname doc-or-args & body]
(if (string? doc-or-args)
(let [args# (first body)
fbody# (rest body)]
`(defn ~fname ~doc-or-args ~args# ~@fbody#))
`(defn ~fname ~doc-or-args
(html ~@body))))
(defmacro defpage
[& args]
`(defpartial ~@args))
(defmacro deflayout
[& args]
`(defpartial ~@args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment