aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfdf.lisp
diff options
context:
space:
mode:
authorTeddy Wing2023-04-21 19:30:01 +0200
committerTeddy Wing2023-04-21 19:30:01 +0200
commit39b5831e74f75c4e21238e044c3b46f8180dcb73 (patch)
tree7ae33b219533a1dcd848ea5b010ed631ccf180d9 /src/xfdf.lisp
parentb353ac4dab798c6b5b70afa5da5101f3365a8985 (diff)
downloadxfdf-39b5831e74f75c4e21238e044c3b46f8180dcb73.tar.bz2
xfdf.lisp: Extract checkbox default value modification to function
Diffstat (limited to 'src/xfdf.lisp')
-rw-r--r--src/xfdf.lisp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/xfdf.lisp b/src/xfdf.lisp
index 3e4effb..112b263 100644
--- a/src/xfdf.lisp
+++ b/src/xfdf.lisp
@@ -64,9 +64,7 @@ indent
'(" ")))
;; TODO: Put checkbox stuff here.
- (let ((value (cond ((eq value t) "Yes")
- ((eq value nil) "Off")
- (t value))))
+ (let ((value (pdf-checkbox-value value)))
(format nil "~
~v{~A~:*~}<field name=\"~A\">
~v{~A~:*~} <value>~A</value>
@@ -81,3 +79,13 @@ value
indent
'(" "))))))
;; * (format t "~v{~A~:*~}<>~A" 5 '("Hello") "Next")
+
+(defun pdf-checkbox-value (value)
+ "If `value` is T or NIL, convert it to the default PDF checkbox values
+'Yes' and 'Off' respectively.
+
+If `value` is anything else, return its identity."
+
+ (cond ((eq value t) "Yes")
+ ((eq value nil) "Off")
+ (t value)))