aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-04-21 19:41:34 +0200
committerTeddy Wing2023-04-21 19:41:34 +0200
commitb23923c159c057090019c05c36ccc3b6a4608fd6 (patch)
tree49db23e67c1c3af18a7238f6d129107eed01600a
parent39b5831e74f75c4e21238e044c3b46f8180dcb73 (diff)
downloadxfdf-b23923c159c057090019c05c36ccc3b6a4608fd6.tar.bz2
xfdf.lisp: Extract field printing code to function
Trying to reduce the size of the `field-xfdf*` function.
-rw-r--r--src/xfdf.lisp29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/xfdf.lisp b/src/xfdf.lisp
index 112b263..98516a3 100644
--- a/src/xfdf.lisp
+++ b/src/xfdf.lisp
@@ -65,19 +65,7 @@ indent
;; TODO: Put checkbox stuff here.
(let ((value (pdf-checkbox-value value)))
- (format nil "~
-~v{~A~:*~}<field name=\"~A\">
-~v{~A~:*~} <value>~A</value>
-~v{~A~:*~}</field>
-"
-indent
-'(" ")
-name
-indent
-'(" ")
-value
-indent
-'(" "))))))
+ (build-xfdf-field name value indent)))))
;; * (format t "~v{~A~:*~}<>~A" 5 '("Hello") "Next")
(defun pdf-checkbox-value (value)
@@ -89,3 +77,18 @@ If `value` is anything else, return its identity."
(cond ((eq value t) "Yes")
((eq value nil) "Off")
(t value)))
+
+(defun build-xfdf-field (name value indent)
+ (format nil "~
+~v{~A~:*~}<field name=\"~A\">
+~v{~A~:*~} <value>~A</value>
+~v{~A~:*~}</field>
+"
+indent
+'(" ")
+name
+indent
+'(" ")
+value
+indent
+'(" ")))