From 39b5831e74f75c4e21238e044c3b46f8180dcb73 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 21 Apr 2023 19:30:01 +0200 Subject: xfdf.lisp: Extract checkbox default value modification to function --- src/xfdf.lisp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') 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~:*~} ~v{~A~:*~} ~A @@ -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))) -- cgit v1.2.3