Skip to content

Instantly share code, notes, and snippets.

@html
Created January 1, 2013 13:13
Show Gist options
  • Save html/4427396 to your computer and use it in GitHub Desktop.
Save html/4427396 to your computer and use it in GitHub Desktop.
weblocks mustache and yaclml macros
(defmacro def-weblocks-mustache (name template)
"Define a named renderer of string TEMPLATE."
(let ((obj (gensym)))
`(let ((,obj (mustache::parse ,template)))
(defun ,name (&optional context)
(let ((mustache:*mustache-output* (make-string-output-stream)))
(mustache::render-body ,obj context ,template)
(get-output-stream-string mustache:*mustache-output*))))))
(defmacro def-weblocks-yaclml-mustache (name &body body)
`(def-weblocks-mustache
,name
(yaclml:with-yaclml-output-to-string
,@body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment