Skip to content

Instantly share code, notes, and snippets.

@thedavidmeister
Created December 29, 2016 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedavidmeister/9812b815b643dedcff60ec0b4f013e51 to your computer and use it in GitHub Desktop.
Save thedavidmeister/9812b815b643dedcff60ec0b4f013e51 to your computer and use it in GitHub Desktop.
(ns pattern-lib.pattern
(:require [hoplon.core :as h]
camel-snake-kebab.core))
(defmacro pattern
[name desc f examples]
(list 'h/div
:class "pattern"
:id (camel-snake-kebab.core/->kebab-case-string name)
`(h/h2 ~name)
`(h/code (str '~f))
`(h/p ~desc)
`(map (fn [[~'d & ~'args]]
(h/div :class "pattern-item"
(h/h3 ~'d)
(h/code :class "clojure"
(map (fn [~'arg]
[(prn-str ~'arg) (h/br)])
~'args))
(h/div :class #{"wrap" "clearfix"} (apply ~f ~'args))))
~examples)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment