aboutsummaryrefslogtreecommitdiff
path: root/json-template.lisp
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2017-05-14 17:08:16 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2017-05-14 17:08:16 +0200
commit8e45362a510236f46f97b6c275b2b8014678f77d (patch)
tree6547fd13032ef5204a780807e422c568d23d7f5e /json-template.lisp
parent00aabb4381d1c7564b3341f8a7e94426237ca041 (diff)
Format NILs as empty strings.
Diffstat (limited to 'json-template.lisp')
-rw-r--r--json-template.lisp16
1 files changed, 9 insertions, 7 deletions
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)))