Function: pdf-info-query--transform-annotation
pdf-info-query--transform-annotation is a natively compiled function
defined in pdf-info.el.
Signature
(pdf-info-query--transform-annotation A)
Source Code
;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-info.el
(defun pdf-info-query--transform-annotation (a)
(cl-labels ((not-empty (s)
(if (not (equal s "")) s)))
(let (a1 a2 a3)
(cl-destructuring-bind (page edges type id flags color contents modified &rest rest)
a
(setq a1 `((page . ,(string-to-number page))
(edges . ,(mapcar #'string-to-number
(split-string edges " " t)))
(type . ,(intern type))
(id . ,(intern id))
(flags . ,(string-to-number flags))
(color . ,(not-empty color))
(contents . ,contents)
(modified . ,(pdf-info-parse-pdf-date modified))))
(when rest
(cl-destructuring-bind (label subject opacity popup-edges popup-is-open created
&rest rest)
rest
(setq a2
`((label . ,(not-empty label))
(subject . ,(not-empty subject))
(opacity . ,(let ((o (not-empty opacity)))
(and o (string-to-number o))))
(popup-edges . ,(let ((p (not-empty popup-edges)))
(when p
(mapcar #'string-to-number
(split-string p " " t)))))
(popup-is-open . ,(equal popup-is-open "1"))
(created . ,(pdf-info-parse-pdf-date (not-empty created)))))
(cond
((eq (cdr (assoc 'type a1)) 'text)
(cl-destructuring-bind (icon state is-open)
rest
(setq a3
`((icon . ,(not-empty icon))
(state . ,(not-empty state))
(is-open . ,(equal is-open "1"))))))
((memq (cdr (assoc 'type a1))
'(squiggly highlight underline strike-out))
(setq a3 `((markup-edges
. ,(mapcar (lambda (r)
(mapcar #'string-to-number
(split-string r " " t)))
rest)))))))))
(append a1 a2 a3))))