oc-csl: Use `org-require-package' instead of `org-cite-csl--barf-without-citeproc'

* lisp/oc-csl.el (org-cite-csl--barf-without-citeproc): Remove.
(org-cite-csl-render-citation):
(org-cite-csl-render-bibliography):
(org-cite-csl-finalizer): Use `org-require-package'.
This commit is contained in:
Ihor Radchenko 2024-05-21 15:57:15 +02:00
parent 5fcd1d9def
commit b26337c255
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 8 deletions

View File

@ -423,11 +423,6 @@ Label is in match group 1.")
;;; Internal functions
;; FIXME: We use `org-require-package' in other places.
(defun org-cite-csl--barf-without-citeproc ()
"Raise an error if Citeproc library is not loaded."
(unless (featurep 'citeproc)
(error "Citeproc library is not loaded")))
(defun org-cite-csl--note-style-p (info)
"Non-nil when bibliography style implies wrapping citations in footnotes.
@ -813,7 +808,7 @@ INFO is the export state, as a property list."
(defun org-cite-csl-render-citation (citation _style _backend info)
"Export CITATION object.
INFO is the export state, as a property list."
(org-cite-csl--barf-without-citeproc)
(org-require-package 'citeproc)
(let ((output (cdr (assq citation (org-cite-csl--rendered-citations info)))))
(if (not (eq 'org (org-cite-csl--output-format info)))
output
@ -824,7 +819,7 @@ INFO is the export state, as a property list."
(defun org-cite-csl-render-bibliography (_keys _files _style props _backend info)
"Export bibliography.
INFO is the export state, as a property list."
(org-cite-csl--barf-without-citeproc)
(org-require-package 'citeproc)
(pcase-let* ((format (org-cite-csl--output-format info))
(`(,outputs ,parameters) (org-cite-csl--rendered-bibliographies info))
(output (cdr (assoc props outputs))))
@ -862,7 +857,7 @@ INFO is the export state, as a property list."
"Add \"hanging\" package if missing from LaTeX output.
OUTPUT is the export document, as a string. INFO is the export state, as a
property list."
(org-cite-csl--barf-without-citeproc)
(org-require-package 'citeproc)
(if (not (eq 'org-latex (org-cite-csl--output-format info)))
output
(with-temp-buffer