Created
January 1, 2013 13:13
-
-
Save html/4427396 to your computer and use it in GitHub Desktop.
weblocks mustache and yaclml macros
This file contains hidden or 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
(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