Function: org-cite-biblatex--package-options

org-cite-biblatex--package-options is a byte-compiled function defined in oc-biblatex.el.gz.

Signature

(org-cite-biblatex--package-options INITIAL STYLE)

Documentation

Return options string for "biblatex" package.

INITIAL is an initial style of comma-separated options, as a string or nil. STYLE is the style definition as a string or nil.

Return a string.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc-biblatex.el.gz
;;; Internal functions
(defun org-cite-biblatex--package-options (initial style)
  "Return options string for \"biblatex\" package.

INITIAL is an initial style of comma-separated options, as a string or nil.
STYLE is the style definition as a string or nil.

Return a string."
  (let* ((options-no-style
          (and initial
               (let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
                 (seq-filter
                  (lambda (option) (not (string-match re option)))
                  (split-string (org-unbracket-string "[" "]" initial)
                                "," t " \t")))))
         ;; Check whether the string is in key=val,...
         (biblatex-options-p (and (stringp style) (string-match-p "\\`[^,=]+=[^,]+\\(,[^=]+=[^,]+\\)\\'" style)))
         (style-options
          (cond
           ((null style) nil)
           ;; Assume it is a valid options string for biblatex if it is in key=val,... format
           ((not (string-match "/" style)) (list (if biblatex-options-p style (concat "style=" style))))
           (t
            (list (concat "bibstyle=" (substring style nil (match-beginning 0)))
                  (concat "citestyle=" (substring style (match-end 0))))))))
    (if (or options-no-style style-options)
        (format "[%s]"
                (mapconcat #'identity
                           (append options-no-style style-options)
                           ","))
      "")))