Function: org-cite-store-export-processor
org-cite-store-export-processor is a byte-compiled function defined in
oc.el.gz.
Signature
(org-cite-store-export-processor INFO)
Documentation
Store export processor in the :cite-export property during export.
Export processor is stored as a triplet, or nil.
When non-nil, it is defined as (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) where NAME is a symbol, whereas BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings, or nil.
INFO is the communication channel, as a plist. It is modified by side-effect.
Source Code
;; Defined in /usr/src/emacs/lisp/org/oc.el.gz
(defun org-cite-store-export-processor (info)
"Store export processor in the `:cite-export' property during export.
Export processor is stored as a triplet, or nil.
When non-nil, it is defined as (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) where
NAME is a symbol, whereas BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings,
or nil.
INFO is the communication channel, as a plist. It is modified by side-effect."
(let* ((err
(lambda (s)
(user-error "Invalid cite export processor definition: %S" s)))
(processor
(pcase (plist-get info :cite-export)
((or "" `nil) nil)
;; Value is a string. It comes from a "cite_export"
;; keyword. It may contain between 1 and 3 tokens, the
;; first one being a symbol and the other (optional) two,
;; strings.
((and (pred stringp) s)
(with-temp-buffer
(save-excursion (insert s))
(let ((result (list (read (current-buffer)))))
(dotimes (_ 2)
(skip-chars-forward " \t")
(cond
((eobp) (push nil result))
((char-equal ?\" (char-after))
(condition-case _
(push (org-not-nil (read (current-buffer))) result)
(error (funcall err s))))
(t
(let ((origin (point)))
(skip-chars-forward "^ \t")
(push (org-not-nil (buffer-substring origin (point)))
result)))))
(unless (eobp) (funcall err s))
(nreverse result))))
;; Value is an alist. It must come from
;; `org-cite-export-processors' variable. Find the most
;; appropriate processor according to current export
;; back-end.
((and (pred consp) alist)
(let* ((backend (plist-get info :back-end))
(candidates
;; Limit candidates to processors associated to
;; back-ends derived from or equal to the current
;; one.
(sort (seq-filter
(pcase-lambda (`(,key . ,_))
(org-export-derived-backend-p backend key))
alist)
(lambda (a b)
(org-export-derived-backend-p (car a) (car b))))))
;; Select the closest candidate, or fallback to t.
(pcase (or (car candidates) (assq t alist))
('nil nil)
(`(,_ . ,p)
;; Normalize value by turning it into a triplet.
(pcase p
(`(,(pred symbolp))
(append p (list nil nil)))
(`(,(pred symbolp) ,(pred string-or-null-p))
(append p (list nil)))
(`(,(pred symbolp)
,(pred string-or-null-p)
,(pred string-or-null-p))
p)
(_ (funcall err p))))
(other (funcall err (cdr other))))))
(other (funcall err other)))))
(pcase processor
('nil nil)
(`(,name . ,_)
(cond
((not (org-cite--get-processor name))
(user-error "Unknown processor %S" name))
((not (org-cite-processor-has-capability-p name 'export))
(user-error "Processor %S is unable to handle citation export" name)))))
(plist-put info :cite-export processor)))