From b23923c159c057090019c05c36ccc3b6a4608fd6 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 21 Apr 2023 19:41:34 +0200 Subject: xfdf.lisp: Extract field printing code to function Trying to reduce the size of the `field-xfdf*` function. --- src/xfdf.lisp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src') 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~:*~} -~v{~A~:*~} ~A -~v{~A~:*~} -" -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~:*~} +~v{~A~:*~} ~A +~v{~A~:*~} +" +indent +'(" ") +name +indent +'(" ") +value +indent +'(" "))) -- cgit v1.2.3