Function: org-cite-read-processor-declaration

org-cite-read-processor-declaration is a byte-compiled function defined in oc.el.gz.

Signature

(org-cite-read-processor-declaration S)

Documentation

Read processor declaration from string S.

Return (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) triplet, when NAME is the processor name, as a symbol, and both BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings or nil. Those strings may contain spaces if they are enclosed within double quotes.

String S is expected to contain between 1 and 3 tokens. The function raises an error when it contains too few or too many tokens. Spurious spaces are ignored.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc.el.gz
(defun org-cite-read-processor-declaration (s)
  "Read processor declaration from string S.

Return (NAME BIBLIOGRAPHY-STYLE CITATION-STYLE) triplet, when
NAME is the processor name, as a symbol, and both
BIBLIOGRAPHY-STYLE and CITATION-STYLE are strings or nil.  Those
strings may contain spaces if they are enclosed within double
quotes.

String S is expected to contain between 1 and 3 tokens.  The
function raises an error when it contains too few or too many
tokens.  Spurious spaces are ignored."
  (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))
          (push (org-not-nil (read (current-buffer)))
                result))
         (t
          (let ((origin (point)))
            (skip-chars-forward "^ \t")
            (push (org-not-nil (buffer-substring origin (point)))
                  result)))))
      (skip-chars-forward " \t")
      (unless (eobp)
        (error "Trailing garbage following cite export processor declaration %S"
               s))
      (nreverse result))))