[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 5e58af5 52/85: oc-csl: Use citeproc-el to create CS
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 5e58af5 52/85: oc-csl: Use citeproc-el to create CSL processor itemgetters |
Date: |
Mon, 27 Sep 2021 15:57:49 -0400 (EDT) |
branch: externals/org
commit 5e58af5dddca52a812a74ff18182f6ce31c68f0e
Author: AndrĂ¡s Simonyi <andras.simonyi@gmail.com>
Commit: Bastien <bzg@gnu.org>
oc-csl: Use citeproc-el to create CSL processor itemgetters
* lisp/oc-csl.el (org-cite-csl--processor): Citeproc-el now provides an
itemgetter constructor with all the required functionality and some more,
so we
use it to create the itemgetter instead of `org-cite-csl--itemgetter' to
avoid
code duplication and make use of the additional features, in particular the
ability to access bibliographies in `org-bibtex' format
(see <https://gewhere.github.io/org-bibtex>).
(org-cite-csl--itemgetter): Is removed since it is no longer used.
---
lisp/oc-csl.el | 31 ++-----------------------------
1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index b5074dc..645b1c0 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -99,6 +99,7 @@
(declare-function citeproc-append-citations "ext:citeproc")
(declare-function citeproc-render-citations "ext:citeproc")
(declare-function citeproc-render-bib "ext:citeproc")
+(declare-function citeproc-hash-itemgetter-from-any "ext:citeproc")
(declare-function org-element-interpret-data "org-element" (data))
(declare-function org-element-map "org-element" (data types fun &optional info
first-match no-recursion with-affiliated))
@@ -336,34 +337,6 @@ or raise an error if the variable is unset."
(other
(user-error "Cannot handle relative style file name" other))))
-(defun org-cite-csl--itemgetter (bibliography)
- "Return Citeproc's \"itemgetter\" function for BIBLIOGRAPHY files.
-The function handles \".bib\", \".bibtex\" and \".json\" files."
- (let ((cache (make-hash-table :test #'equal)))
- (dolist (file bibliography)
- (pcase (file-name-extension file)
- ("json"
- (let ((json-array-type 'list)
- (json-key-type 'symbol))
- (dolist (item (json-read-file file))
- (puthash (cdr (assq 'id item)) item cache))))
- ((and (or "bib" "bibtex") ext)
- (with-temp-buffer
- (insert-file-contents file)
- (goto-char (point-min))
- (bibtex-set-dialect (if (string= ext "bib") 'biblatex 'BibTeX) t)
- (bibtex-map-entries
- (lambda (key &rest _)
- (puthash key
- (citeproc-bt-entry-to-csl (bibtex-parse-entry))
- cache)))))
- (ext
- (user-error "Unknown bibliography extension: %S" ext))))
- (lambda (itemids)
- (mapcar (lambda (id)
- (cons id (gethash id cache)))
- itemids))))
-
(defun org-cite-csl--locale-getter ()
"Return a locale getter.
The getter looks for locales in `org-cite-csl-locales-dir' directory. If it
@@ -391,7 +364,7 @@ property in INFO."
(processor
(citeproc-create
(org-cite-csl--style-file info)
- (org-cite-csl--itemgetter bibliography)
+ (citeproc-hash-itemgetter-from-any bibliography)
(org-cite-csl--locale-getter)
locale)))
(plist-put info :cite-citeproc-processor processor)
- [elpa] externals/org f5392c4 08/85: Merge branch 'km/from-emacs-master', (continued)
- [elpa] externals/org f5392c4 08/85: Merge branch 'km/from-emacs-master', ELPA Syncer, 2021/09/27
- [elpa] externals/org 4063d4c 06/85: org: Rename for more consistency, ELPA Syncer, 2021/09/27
- [elpa] externals/org 9a4a24a 12/85: mk/targets.mk: Fix ORGVERSION in tag-less repos, ELPA Syncer, 2021/09/27
- [elpa] externals/org 2311677 13/85: mk/server.mk: Use a new path, ELPA Syncer, 2021/09/27
- [elpa] externals/org ce99b55 14/85: Merge commit '986341bd08', ELPA Syncer, 2021/09/27
- [elpa] externals/org 26b0297 20/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 45a5f17 21/85: org-manual.org: Augment TODO keywords example, ELPA Syncer, 2021/09/27
- [elpa] externals/org 35690cd 36/85: org-src.el (org-src--contents-for-write-back): Do not indent blank lines, ELPA Syncer, 2021/09/27
- [elpa] externals/org faf1ba8 34/85: Merge branch 'bugfix', ELPA Syncer, 2021/09/27
- [elpa] externals/org 63a5af9 63/85: Backport commit 85e9e5f61 from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org 5e58af5 52/85: oc-csl: Use citeproc-el to create CSL processor itemgetters,
ELPA Syncer <=
- [elpa] externals/org be0cdd1 40/85: org-mouse: Support intermediate-state checkboxes, ELPA Syncer, 2021/09/27
- [elpa] externals/org db67c7e 55/85: Move some ob-*el files to the new org-contrib repo, ELPA Syncer, 2021/09/27
- [elpa] externals/org 2aa2615 59/85: Document new agenda faces in the ORG-NEWS, ELPA Syncer, 2021/09/27
- [elpa] externals/org b80b0a5 51/85: org-clock.el: Make org-notify support macOS notification, ELPA Syncer, 2021/09/27
- [elpa] externals/org 78783f4 48/85: ob-core.el: Add ability to use closures as default header arguments, ELPA Syncer, 2021/09/27
- [elpa] externals/org b2da9ea 64/85: Backport commit 0da8118dc from Emacs, ELPA Syncer, 2021/09/27
- [elpa] externals/org 7d67719 68/85: org-manual: comment about latex code-block export, ELPA Syncer, 2021/09/27
- [elpa] externals/org 80798fc 72/85: oc.el (org-cite-register-processor): Silence a compiler warning, ELPA Syncer, 2021/09/27
- [elpa] externals/org 593740c 74/85: etc/ORG-NEWS: Mention the citation engine and reorder items, ELPA Syncer, 2021/09/27
- [elpa] externals/org c76a7ee 76/85: org: Refactor width in `org-display-inline-images', ELPA Syncer, 2021/09/27