From 8e45362a510236f46f97b6c275b2b8014678f77d Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 14 May 2017 17:08:16 +0200 Subject: Format NILs as empty strings. --- json-template.lisp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'json-template.lisp') diff --git a/json-template.lisp b/json-template.lisp index 0abd91b..5607004 100644 --- a/json-template.lisp +++ b/json-template.lisp @@ -177,13 +177,15 @@ (write-string (second thing) stream)) (:variable (destructuring-bind (variable formatter) (cdr thing) - (let ((value (lookup-context contexts variable))) - (format stream "~A" - (if formatter - (funcall (cdr (assoc formatter *template-formatters* - :test #'equal)) - value) - value))))) + (let* ((value (lookup-context contexts variable)) + (formatted-value (if formatter + (funcall (cdr (assoc formatter *template-formatters* + :test #'equal)) + value) + value))) + (typecase formatted-value + (null (values)) + (t (format stream "~A" formatted-value)))))) (:section (destructuring-bind (section branch alternative) (cdr thing) (let ((value (lookup-context contexts section))) -- cgit v1.2.3