From c36cb7452520e4aa2daaaa29f3411d2cb20452cf Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 21 Dec 2024 17:26:00 +0100 Subject: [PATCH] updaet citeproc Signed-off-by: Andreas Gerler --- elpa/citeproc-20230228.1414/citeproc-pkg.el | 21 ----- .../citeproc-autoloads.el | 90 +++---------------- .../citeproc-biblatex.el | 4 +- .../citeproc-bibtex.el | 3 +- .../citeproc-choose.el | 0 .../citeproc-cite.el | 42 ++++++++- .../citeproc-context.el | 52 ++++++----- .../citeproc-date.el | 3 +- .../citeproc-disamb.el | 0 .../citeproc-formatters.el | 37 +++++--- .../citeproc-generic-elements.el | 2 +- .../citeproc-itemdata.el | 0 .../citeproc-itemgetters.el | 0 .../citeproc-lib.el | 16 +--- .../citeproc-locale.el | 0 .../citeproc-macro.el | 0 .../citeproc-name.el | 0 .../citeproc-number.el | 0 elpa/citeproc-20240722.1110/citeproc-pkg.el | 18 ++++ .../citeproc-prange.el | 2 + .../citeproc-proc.el | 8 ++ .../citeproc-rt.el | 9 +- .../citeproc-s.el | 25 +++--- .../citeproc-sort.el | 15 ++-- .../citeproc-style.el | 30 ++++--- .../citeproc-subbibs.el | 5 +- .../citeproc-term.el | 0 .../citeproc-test-human.el | 0 .../citeproc.el | 21 +++-- 29 files changed, 205 insertions(+), 198 deletions(-) delete mode 100644 elpa/citeproc-20230228.1414/citeproc-pkg.el rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-autoloads.el (57%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-biblatex.el (99%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-bibtex.el (99%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-choose.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-cite.el (92%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-context.el (91%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-date.el (99%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-disamb.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-formatters.el (93%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-generic-elements.el (99%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-itemdata.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-itemgetters.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-lib.el (89%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-locale.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-macro.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-name.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-number.el (100%) create mode 100644 elpa/citeproc-20240722.1110/citeproc-pkg.el rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-prange.el (99%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-proc.el (96%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-rt.el (98%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-s.el (93%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-sort.el (95%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-style.el (94%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-subbibs.el (95%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-term.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc-test-human.el (100%) rename elpa/{citeproc-20230228.1414 => citeproc-20240722.1110}/citeproc.el (95%) diff --git a/elpa/citeproc-20230228.1414/citeproc-pkg.el b/elpa/citeproc-20230228.1414/citeproc-pkg.el deleted file mode 100644 index 980f8dd5..00000000 --- a/elpa/citeproc-20230228.1414/citeproc-pkg.el +++ /dev/null @@ -1,21 +0,0 @@ -(define-package "citeproc" "20230228.1414" "A CSL 1.0.2 Citation Processor" - '((emacs "26") - (dash "2.13.0") - (s "1.12.0") - (f "0.18.0") - (queue "0.2") - (string-inflection "1.0") - (org "9") - (parsebib "2.4")) - :commit "290320fc579f886255f00d7268600df7fa5cc7e8" :authors - '(("András Simonyi" . "andras.simonyi@gmail.com")) - :maintainers - '(("András Simonyi" . "andras.simonyi@gmail.com")) - :maintainer - '("András Simonyi" . "andras.simonyi@gmail.com") - :keywords - '("bib") - :url "https://github.com/andras-simonyi/citeproc-el") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/citeproc-20230228.1414/citeproc-autoloads.el b/elpa/citeproc-20240722.1110/citeproc-autoloads.el similarity index 57% rename from elpa/citeproc-20230228.1414/citeproc-autoloads.el rename to elpa/citeproc-20240722.1110/citeproc-autoloads.el index e34bfe76..6a99cb54 100644 --- a/elpa/citeproc-20230228.1414/citeproc-autoloads.el +++ b/elpa/citeproc-20240722.1110/citeproc-autoloads.el @@ -1,217 +1,153 @@ -;;; citeproc-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- -;; +;;; citeproc-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- +;; Generated by the `loaddefs-generate' function. + +;; This file is part of GNU Emacs. + ;;; Code: -(add-to-list 'load-path (directory-file-name - (or (file-name-directory #$) (car load-path)))) +(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path))) + -;;;### (autoloads nil "citeproc" "citeproc.el" (0 0 0 0)) ;;; Generated autoloads from citeproc.el (register-definition-prefixes "citeproc" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-biblatex" "citeproc-biblatex.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-biblatex.el (register-definition-prefixes "citeproc-biblatex" '("citeproc-blt-")) -;;;*** -;;;### (autoloads nil "citeproc-bibtex" "citeproc-bibtex.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-bibtex.el (register-definition-prefixes "citeproc-bibtex" '("citeproc-bt-")) -;;;*** -;;;### (autoloads nil "citeproc-choose" "citeproc-choose.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-choose.el (register-definition-prefixes "citeproc-choose" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-cite" "citeproc-cite.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-cite.el (register-definition-prefixes "citeproc-cite" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-context" "citeproc-context.el" (0 -;;;;;; 0 0 0)) ;;; Generated autoloads from citeproc-context.el (register-definition-prefixes "citeproc-context" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-date" "citeproc-date.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-date.el (register-definition-prefixes "citeproc-date" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-disamb" "citeproc-disamb.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-disamb.el (register-definition-prefixes "citeproc-disamb" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-formatters" "citeproc-formatters.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-formatters.el (register-definition-prefixes "citeproc-formatters" '("citeproc-f")) -;;;*** -;;;### (autoloads nil "citeproc-generic-elements" "citeproc-generic-elements.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-generic-elements.el (register-definition-prefixes "citeproc-generic-elements" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-itemdata" "citeproc-itemdata.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-itemdata.el (register-definition-prefixes "citeproc-itemdata" '("citeproc-itd-")) -;;;*** -;;;### (autoloads nil "citeproc-itemgetters" "citeproc-itemgetters.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-itemgetters.el (register-definition-prefixes "citeproc-itemgetters" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-lib" "citeproc-lib.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-lib.el (register-definition-prefixes "citeproc-lib" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-locale" "citeproc-locale.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-locale.el (register-definition-prefixes "citeproc-locale" '("citeproc-locale-")) -;;;*** -;;;### (autoloads nil "citeproc-macro" "citeproc-macro.el" (0 0 0 -;;;;;; 0)) ;;; Generated autoloads from citeproc-macro.el (register-definition-prefixes "citeproc-macro" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-name" "citeproc-name.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-name.el (register-definition-prefixes "citeproc-name" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-number" "citeproc-number.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-number.el (register-definition-prefixes "citeproc-number" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-prange" "citeproc-prange.el" (0 0 -;;;;;; 0 0)) ;;; Generated autoloads from citeproc-prange.el (register-definition-prefixes "citeproc-prange" '("citeproc-prange-")) -;;;*** -;;;### (autoloads nil "citeproc-proc" "citeproc-proc.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-proc.el (register-definition-prefixes "citeproc-proc" '("citeproc-proc-")) -;;;*** -;;;### (autoloads nil "citeproc-rt" "citeproc-rt.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-rt.el (register-definition-prefixes "citeproc-rt" '("citeproc-rt-")) -;;;*** -;;;### (autoloads nil "citeproc-s" "citeproc-s.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-s.el (register-definition-prefixes "citeproc-s" '("citeproc-s-")) -;;;*** -;;;### (autoloads nil "citeproc-sort" "citeproc-sort.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-sort.el (register-definition-prefixes "citeproc-sort" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-style" "citeproc-style.el" (0 0 0 -;;;;;; 0)) ;;; Generated autoloads from citeproc-style.el (register-definition-prefixes "citeproc-style" '("citeproc-")) -;;;*** -;;;### (autoloads nil "citeproc-subbibs" "citeproc-subbibs.el" (0 -;;;;;; 0 0 0)) ;;; Generated autoloads from citeproc-subbibs.el (register-definition-prefixes "citeproc-subbibs" '("citeproc-sb-")) -;;;*** -;;;### (autoloads nil "citeproc-term" "citeproc-term.el" (0 0 0 0)) ;;; Generated autoloads from citeproc-term.el (register-definition-prefixes "citeproc-term" '("citeproc-term-")) -;;;*** -;;;### (autoloads nil "citeproc-test-human" "citeproc-test-human.el" -;;;;;; (0 0 0 0)) ;;; Generated autoloads from citeproc-test-human.el (register-definition-prefixes "citeproc-test-human" '("citeproc-test-human-")) - -;;;*** -;;;### (autoloads nil nil ("citeproc-pkg.el") (0 0 0 0)) +;;; End of scraped data + +(provide 'citeproc-autoloads) -;;;*** - ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t -;; coding: utf-8 +;; no-native-compile: t +;; coding: utf-8-emacs-unix ;; End: + ;;; citeproc-autoloads.el ends here diff --git a/elpa/citeproc-20230228.1414/citeproc-biblatex.el b/elpa/citeproc-20240722.1110/citeproc-biblatex.el similarity index 99% rename from elpa/citeproc-20230228.1414/citeproc-biblatex.el rename to elpa/citeproc-20240722.1110/citeproc-biblatex.el index decb1455..0cb218d3 100644 --- a/elpa/citeproc-20230228.1414/citeproc-biblatex.el +++ b/elpa/citeproc-20240722.1110/citeproc-biblatex.el @@ -26,6 +26,8 @@ ;;; Code: (require 'parse-time) +(require 'compat) + (require 'citeproc-bibtex) (defvar citeproc-blt-to-csl-types-alist @@ -473,7 +475,7 @@ biblatex variables in B." (citeproc-blt--get-standard 'address b))) (push (cons csl-place-var ~location) result))) ;; url - (-when-let (url (or (let ((u (alist-get 'url b))) (and u (citeproc-s-replace "\\" "" u))) + (-when-let (url (or (let ((u (alist-get 'url b))) (and u (string-replace "\\" "" u))) (when-let ((~eprinttype (or (alist-get 'eprinttype b) (alist-get 'archiveprefix b))) (~eprint (alist-get 'eprint b)) diff --git a/elpa/citeproc-20230228.1414/citeproc-bibtex.el b/elpa/citeproc-20240722.1110/citeproc-bibtex.el similarity index 99% rename from elpa/citeproc-20230228.1414/citeproc-bibtex.el rename to elpa/citeproc-20240722.1110/citeproc-bibtex.el index 41092cc2..aeb17d9a 100644 --- a/elpa/citeproc-20230228.1414/citeproc-bibtex.el +++ b/elpa/citeproc-20240722.1110/citeproc-bibtex.el @@ -32,6 +32,7 @@ (require 's) (require 'org) (require 'map) +(require 'compat) ;; Handle the fact that org-bibtex has been renamed to ol-bibtex -- for the time ;; being we support both feature names. (or (require 'ol-bibtex nil t) @@ -262,7 +263,7 @@ replacements." (let ((wo-quotes (if (and (string= (substring s 0 1) "\"") (string= (substring s -1) "\"")) (substring s 1 -1) s))) - (citeproc-s-replace "\\&" "&" wo-quotes))) + (string-replace "\\&" "&" wo-quotes))) (defun citeproc-bt--to-csl (s &optional with-nocase) "Convert a BibTeX field S to a CSL one. diff --git a/elpa/citeproc-20230228.1414/citeproc-choose.el b/elpa/citeproc-20240722.1110/citeproc-choose.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-choose.el rename to elpa/citeproc-20240722.1110/citeproc-choose.el diff --git a/elpa/citeproc-20230228.1414/citeproc-cite.el b/elpa/citeproc-20240722.1110/citeproc-cite.el similarity index 92% rename from elpa/citeproc-20230228.1414/citeproc-cite.el rename to elpa/citeproc-20240722.1110/citeproc-cite.el index 729ad138..007b97f5 100644 --- a/elpa/citeproc-20230228.1414/citeproc-cite.el +++ b/elpa/citeproc-20240722.1110/citeproc-cite.el @@ -1,6 +1,6 @@ ;;; citeproc-cite.el --- cite and citation rendering -*- lexical-binding: t; -*- -;; Copyright (C) 2017-2021 András Simonyi +;; Copyright (C) 2017-2024 András Simonyi ;; Author: András Simonyi @@ -40,6 +40,11 @@ (require 'citeproc-formatters) (require 'citeproc-sort) (require 'citeproc-subbibs) +(require 'citeproc-date) +(require 'citeproc-biblatex) + + +(declare-function citeproc-style-category "citeproc-style" (style)) (cl-defstruct (citeproc-citation (:constructor citeproc-citation-create)) "A struct representing a citation. @@ -77,6 +82,35 @@ Each function takes a single argument, a rich-text, and returns a post-processed rich-text value. The functions are applied in the order they appear in the list.") +(defun citeproc-cite--parse-locator-extra (s) + "Parse extra locator text S into locator-date and locator-extra. +Return a pair (LOCATOR-DATE . LOCATOR-EXTRA) where +- LOCATOR-DATE is a `citeproc-date' struct or nil, and +- LOCATOR-EXTRA is a string or nil." + (let (locator-date locator-extra) + (if (not (string-match-p "^[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" s)) + (setq locator-extra (and (not (s-blank-str-p s)) s)) + (setq locator-date (citeproc-date-parse (citeproc-blt--to-csl-date + (substring s 0 10)))) + (let ((extra (substring s 10))) + (unless (s-blank-str-p extra) (setq locator-extra extra)))) + (cons locator-date locator-extra))) + +(defun citeproc-cite--internalize-locator (cite) + "Internalize a CITE struct's locator by parsing it into fields. +If the \"|\" separator is present in the locator then parse it +into `locator', `locator-extra' and `locator-date', and update +CITE with these fields accordingly. Returns the possibly modified +CITE." + (when-let ((locator (alist-get 'locator cite)) + (separator-pos (cl-position ?| locator))) + (setf (alist-get 'locator cite) (substring locator 0 separator-pos)) + (pcase-let ((`(,locator-date . ,locator-extra) (citeproc-cite--parse-locator-extra + (substring locator (1+ separator-pos))))) + (when locator-date (push (cons 'locator-date locator-date) cite)) + (when locator-extra (push (cons 'locator-extra locator-extra) cite)))) + cite) + (defun citeproc-cite--varlist (cite) "Return the varlist belonging to CITE." (let* ((itd (alist-get 'itd cite)) @@ -87,7 +121,8 @@ order they appear in the list.") '(label locator suppress-author suppress-date stop-rendering-at position near-note first-reference-note-number ignore-et-al - bib-entry locator-only use-short-title)) + bib-entry locator-only use-short-title + locator-extra locator-date)) cite))) (nconc cite-vv item-vv))) @@ -228,7 +263,8 @@ For the optional INTERNAL-LINKS argument see (when outer-attrs (setq result (list outer-attrs result))) ;; Prepend author to textual citations - (when (eq (citeproc-citation-mode c) 'textual) + (when (and (eq (citeproc-citation-mode c) 'textual) + (not (member (citeproc-style-category style) '("numeric" "label")))) (let* ((first-elt (car cites)) ;; First elt is either a cite or a cite group. ;; If the latter then we need to locate the ;; first cite as the 2nd element of the first diff --git a/elpa/citeproc-20230228.1414/citeproc-context.el b/elpa/citeproc-20240722.1110/citeproc-context.el similarity index 91% rename from elpa/citeproc-20230228.1414/citeproc-context.el rename to elpa/citeproc-20240722.1110/citeproc-context.el index c32940e6..7af136dc 100644 --- a/elpa/citeproc-20230228.1414/citeproc-context.el +++ b/elpa/citeproc-20240722.1110/citeproc-context.el @@ -168,16 +168,6 @@ TYPED RTS is a list of (RICH-TEXT . TYPE) pairs" "Return the first text associated with TERM in CONTEXT." (citeproc-term-text-from-terms term (citeproc-context-terms context))) -(defun citeproc-term-inflected-text (term form number context) - "Return the text associated with TERM having FORM and NUMBER." - (let ((matches - (--select (string= term (citeproc-term-name it)) - (citeproc-context-terms context)))) - (cond ((not matches) nil) - ((= (length matches) 1) - (citeproc-term-text (car matches))) - (t (citeproc-term--inflected-text-1 matches form number))))) - (defconst citeproc--term-form-fallback-alist '((verb-short . verb) (symbol . short) @@ -185,17 +175,21 @@ TYPED RTS is a list of (RICH-TEXT . TYPE) pairs" (short . long)) "Alist containing the fallback form for each term form.") -(defun citeproc-term--inflected-text-1 (matches form number) - (let ((match (--first (and (eq form (citeproc-term-form it)) - (or (not (citeproc-term-number it)) - (eq number (citeproc-term-number it)))) - matches))) - (if match - (citeproc-term-text match) - (citeproc-term--inflected-text-1 - matches - (alist-get form citeproc--term-form-fallback-alist) - number)))) +(defun citeproc-term-inflected-text (term form number context) + "Return the text associated with TERM having FORM and NUMBER." + (let ((matches + (--select (string= term (citeproc-term-name it)) + (citeproc-context-terms context)))) + (if (not matches) nil + (let (match) + (while (and (not match) form) + (setq match (--first (and (eq form (citeproc-term-form it)) + (or (not (citeproc-term-number it)) + (eq number (citeproc-term-number it)))) + matches)) + (unless match + (setq form (alist-get form citeproc--term-form-fallback-alist)))) + (when match (citeproc-term-text match)))))) (defun citeproc-term-get-gender (term context) "Return the gender of TERM or nil if none is given." @@ -224,6 +218,20 @@ no internal links should be produced." ;; Else link each cite to the corresponding bib item. (if (eq mode 'cite) 'cited-item-no 'bib-item-no))))) +(defun citeproc-context-maybe-stop-rendering + (trigger context result &optional var) + "Stop rendering if a (`stop-rendering-at'. TRIGGER) pair is present in CONTEXT. +In case of stopping return with RESULT. If the optional VAR +symbol is non-nil then rendering is stopped only if VAR is eq to +TRIGGER." + (if (and (eq trigger (alist-get 'stop-rendering-at (citeproc-context-vars context))) + (or (not var) (eq var trigger)) + (eq (cdr result) 'present-var)) + (let ((rt-result (car result))) + (push '(stopped-rendering . t) (car rt-result)) + (throw 'stop-rendering (citeproc-rt-render-affixes rt-result))) + result)) + (defun citeproc-render-varlist-in-rt (var-alist style mode render-mode &optional internal-links no-external-links) "Render an item described by VAR-ALIST with STYLE in rich-text. @@ -263,7 +271,7 @@ external links." (citeproc-context-int-link-attrval style internal-links mode (alist-get 'position var-alist))) (cite-no-attr-val (cons cite-no-attr - (alist-get 'citation-number var-alist)))) + (alist-get 'citation-number var-alist)))) (cond ((consp rendered) (setf (car rendered) (-snoc (car rendered) cite-no-attr-val))) ((stringp rendered) (setq rendered diff --git a/elpa/citeproc-20230228.1414/citeproc-date.el b/elpa/citeproc-20240722.1110/citeproc-date.el similarity index 99% rename from elpa/citeproc-20230228.1414/citeproc-date.el rename to elpa/citeproc-20240722.1110/citeproc-date.el index abf166f8..e514909b 100644 --- a/elpa/citeproc-20230228.1414/citeproc-date.el +++ b/elpa/citeproc-20240722.1110/citeproc-date.el @@ -34,6 +34,7 @@ (require 'citeproc-lib) (require 'citeproc-rt) (require 'citeproc-context) +(require 'citeproc-number) (cl-defstruct (citeproc-date (:constructor citeproc-date-create)) "Struct for representing dates. @@ -94,7 +95,7 @@ Set the remaining slots to the values SEASON and CIRCA." (cons nil 'empty-vars))) (cons nil 'empty-vars)))) ;; Handle `year' citation mode by stopping if needed - (citeproc-lib-maybe-stop-rendering 'issued context result var-sym))) + (citeproc-context-maybe-stop-rendering 'issued context result var-sym))) (defun citeproc--date-part (attrs _context &rest _body) "Function corresponding to the date-part CSL element." diff --git a/elpa/citeproc-20230228.1414/citeproc-disamb.el b/elpa/citeproc-20240722.1110/citeproc-disamb.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-disamb.el rename to elpa/citeproc-20240722.1110/citeproc-disamb.el diff --git a/elpa/citeproc-20230228.1414/citeproc-formatters.el b/elpa/citeproc-20240722.1110/citeproc-formatters.el similarity index 93% rename from elpa/citeproc-20230228.1414/citeproc-formatters.el rename to elpa/citeproc-20240722.1110/citeproc-formatters.el index 5897b26c..6168a753 100644 --- a/elpa/citeproc-20230228.1414/citeproc-formatters.el +++ b/elpa/citeproc-20240722.1110/citeproc-formatters.el @@ -33,8 +33,11 @@ (require 's) (require 'cl-lib) - (cl-defstruct (citeproc-formatter (:constructor citeproc-formatter-create)) - "Output formatter struct with slots RT, CITE, BIB-ITEM and BIB. +(require 'citeproc-s) +(require 'citeproc-rt) + +(cl-defstruct (citeproc-formatter (:constructor citeproc-formatter-create)) + "Output formatter struct with slots RT, CITE, BIB-ITEM and BIB. RT is a one-argument function mapping a rich-text to its formatted version, CITE is a one-argument function mapping the output of RT for a @@ -48,9 +51,9 @@ BIB is a two-argument function mapping a list of formatted bibliography, NO-EXTERNAL-LINKS is non-nil if the formatter doesn't support external linking." - rt (cite #'identity) (bib-item (lambda (x _) x)) - (bib (lambda (x _) (mapconcat #'identity x "\n\n"))) - (no-external-links nil)) + rt (cite #'identity) (bib-item (lambda (x _) x)) + (bib (lambda (x _) (mapconcat #'identity x "\n\n"))) + (no-external-links nil)) (defun citeproc-formatter-fun-create (fmt-alist) "Return a rich-text formatter function based on FMT-ALIST. @@ -164,13 +167,18 @@ Performs finalization by removing unnecessary zero-width spaces." (setq result (citeproc-s-replace-all-seq result '((" ​" . " ") ("​ " . " ") ("​," . ",") ("​;" . ";") ("​:" . ":") ("​." . ".")))) - ;; Starting and ending z-w spaces are also removed, but not before an - ;; asterisk to avoid creating an Org heading. + ;; Starting and ending z-w spaces are also removed, but not before an asterisk + ;; to avoid creating an Org heading. (when (and (= (aref result 0) 8203) (not (= (aref result 1) ?*))) (setq result (substring result 1))) (when (= (aref result (- (length result) 1)) 8203) - (setq result (substring result 0 -1)))) + (setq result (substring result 0 -1))) + ;; Prepend a zero width no-break space when the text starts with + ;; superscript to make Org parse it correctly. + ;; NOTE: This is a workaround, ideally should be fixed in Org. + (when (= (aref result 0) ?^) + (setq result (concat "" result)))) result)) ;; HTML @@ -257,11 +265,16 @@ CSL tests." "Return the LaTeX-escaped version of string S." (replace-regexp-in-string citeproc-fmt--latex-esc-regex "\\\\\\&" s)) +(defconst citeproc-fmt--latex-uri-esc-regex + (regexp-opt '("#" "%")) + "Regular expression matching characters to be escaped in URIs for LaTeX output.") + (defun citeproc-fmt--latex-href (text uri) - (let ((escaped-uri (replace-regexp-in-string "%" "\\\\%" uri))) - (if (string-prefix-p "http" text) - (concat "\\url{" escaped-uri "}") - (concat "\\href{" escaped-uri "}{" text "}")))) + (let ((escaped-uri (replace-regexp-in-string + citeproc-fmt--latex-uri-esc-regex "\\\\\\&" uri))) + (if (string-prefix-p "http" text) + (concat "\\url{" escaped-uri "}") + (concat "\\href{" escaped-uri "}{" text "}")))) (defconst citeproc-fmt--latex-alist `((unformatted . ,#'citeproc-fmt--latex-escape) diff --git a/elpa/citeproc-20230228.1414/citeproc-generic-elements.el b/elpa/citeproc-20240722.1110/citeproc-generic-elements.el similarity index 99% rename from elpa/citeproc-20230228.1414/citeproc-generic-elements.el rename to elpa/citeproc-20240722.1110/citeproc-generic-elements.el index 2d1a3391..306a367e 100644 --- a/elpa/citeproc-20230228.1414/citeproc-generic-elements.el +++ b/elpa/citeproc-20240722.1110/citeproc-generic-elements.el @@ -143,7 +143,7 @@ (setq type (cdr macro-val))))) ;; We stop if only the title had to be rendered. (let ((result (cons (citeproc-rt-format-single attrs content context) type))) - (citeproc-lib-maybe-stop-rendering + (citeproc-context-maybe-stop-rendering 'title context result (or (and .variable (intern .variable)) t)))))) (provide 'citeproc-generic-elements) diff --git a/elpa/citeproc-20230228.1414/citeproc-itemdata.el b/elpa/citeproc-20240722.1110/citeproc-itemdata.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-itemdata.el rename to elpa/citeproc-20240722.1110/citeproc-itemdata.el diff --git a/elpa/citeproc-20230228.1414/citeproc-itemgetters.el b/elpa/citeproc-20240722.1110/citeproc-itemgetters.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-itemgetters.el rename to elpa/citeproc-20240722.1110/citeproc-itemgetters.el diff --git a/elpa/citeproc-20230228.1414/citeproc-lib.el b/elpa/citeproc-20240722.1110/citeproc-lib.el similarity index 89% rename from elpa/citeproc-20230228.1414/citeproc-lib.el rename to elpa/citeproc-20240722.1110/citeproc-lib.el index 1d626c21..004524e8 100644 --- a/elpa/citeproc-20230228.1414/citeproc-lib.el +++ b/elpa/citeproc-20240722.1110/citeproc-lib.el @@ -38,7 +38,7 @@ ) (defconst citeproc--date-vars - '(accessed available-date event-date issued original-date submitted) + '(accessed available-date event-date issued original-date submitted locator-date) "CSL date variables.") (defconst citeproc--name-vars @@ -145,20 +145,6 @@ numeric content." (s-matches-p "\\`[[:alpha:]]?[[:digit:]]+[[:alpha:]]*\\(\\( *\\([,&-]\\|--\\) *\\)?[[:alpha:]]?[[:digit:]]+[[:alpha:]]*\\)?\\'" val)))) -(defun citeproc-lib-maybe-stop-rendering - (trigger context result &optional var) - "Stop rendering if a (`stop-rendering-at'. TRIGGER) pair is present in CONTEXT. -In case of stopping return with RESULT. If the optional VAR -symbol is non-nil then rendering is stopped only if VAR is eq to -TRIGGER." - (if (and (eq trigger (alist-get 'stop-rendering-at (citeproc-context-vars context))) - (or (not var) (eq var trigger)) - (eq (cdr result) 'present-var)) - (let ((rt-result (car result))) - (push '(stopped-rendering . t) (car rt-result)) - (throw 'stop-rendering (citeproc-rt-render-affixes rt-result))) - result)) - (provide 'citeproc-lib) ;;; citeproc-lib.el ends here diff --git a/elpa/citeproc-20230228.1414/citeproc-locale.el b/elpa/citeproc-20240722.1110/citeproc-locale.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-locale.el rename to elpa/citeproc-20240722.1110/citeproc-locale.el diff --git a/elpa/citeproc-20230228.1414/citeproc-macro.el b/elpa/citeproc-20240722.1110/citeproc-macro.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-macro.el rename to elpa/citeproc-20240722.1110/citeproc-macro.el diff --git a/elpa/citeproc-20230228.1414/citeproc-name.el b/elpa/citeproc-20240722.1110/citeproc-name.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-name.el rename to elpa/citeproc-20240722.1110/citeproc-name.el diff --git a/elpa/citeproc-20230228.1414/citeproc-number.el b/elpa/citeproc-20240722.1110/citeproc-number.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-number.el rename to elpa/citeproc-20240722.1110/citeproc-number.el diff --git a/elpa/citeproc-20240722.1110/citeproc-pkg.el b/elpa/citeproc-20240722.1110/citeproc-pkg.el new file mode 100644 index 00000000..f64f89c5 --- /dev/null +++ b/elpa/citeproc-20240722.1110/citeproc-pkg.el @@ -0,0 +1,18 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "citeproc" "20240722.1110" + "A CSL 1.0.2 Citation Processor." + '((emacs "26") + (dash "2.13.0") + (s "1.12.0") + (f "0.18.0") + (queue "0.2") + (string-inflection "1.0") + (org "9") + (parsebib "2.4") + (compat "28.1")) + :url "https://github.com/andras-simonyi/citeproc-el" + :commit "54184baaff555b5c7993d566d75dd04ed485b5c0" + :revdesc "54184baaff55" + :keywords '("bib") + :authors '(("András Simonyi" . "andras.simonyi@gmail.com")) + :maintainers '(("András Simonyi" . "andras.simonyi@gmail.com"))) diff --git a/elpa/citeproc-20230228.1414/citeproc-prange.el b/elpa/citeproc-20240722.1110/citeproc-prange.el similarity index 99% rename from elpa/citeproc-20230228.1414/citeproc-prange.el rename to elpa/citeproc-20240722.1110/citeproc-prange.el index 52a5fb39..9db65f0b 100644 --- a/elpa/citeproc-20230228.1414/citeproc-prange.el +++ b/elpa/citeproc-20240722.1110/citeproc-prange.el @@ -25,6 +25,8 @@ ;;; Code: +(require 'citeproc-s) + (defun citeproc-prange--end-significant (start end len) "Return the significant digits of the end in page range START END. START and END are strings of equal length containing integers. If diff --git a/elpa/citeproc-20230228.1414/citeproc-proc.el b/elpa/citeproc-20240722.1110/citeproc-proc.el similarity index 96% rename from elpa/citeproc-20230228.1414/citeproc-proc.el rename to elpa/citeproc-20240722.1110/citeproc-proc.el index 9fd635b8..001e734d 100644 --- a/elpa/citeproc-20230228.1414/citeproc-proc.el +++ b/elpa/citeproc-20240722.1110/citeproc-proc.el @@ -230,6 +230,14 @@ Return the PROC-internal representation of REP." (let ((filters (citeproc-proc-bib-filters proc))) (and filters (not (equal filters '(nil)))))) +(defun citeproc-proc-max-offset (itds) + "Return the maximal first field width of bibitems in ITDS. +ITDS should be the value of the itemdata field of a citeproc-proc +structure." + (cl-loop for itd being the hash-values of itds + when (listp (citeproc-itemdata-rawbibitem itd)) maximize + (length (citeproc-rt-to-plain (cadr (citeproc-itemdata-rawbibitem itd)))))) + (provide 'citeproc-proc) ;;; citeproc-proc.el ends here diff --git a/elpa/citeproc-20230228.1414/citeproc-rt.el b/elpa/citeproc-20240722.1110/citeproc-rt.el similarity index 98% rename from elpa/citeproc-20230228.1414/citeproc-rt.el rename to elpa/citeproc-20240722.1110/citeproc-rt.el index 9e36268a..26d06222 100644 --- a/elpa/citeproc-20230228.1414/citeproc-rt.el +++ b/elpa/citeproc-20240722.1110/citeproc-rt.el @@ -36,6 +36,7 @@ (require 'cl-lib) (require 'let-alist) (require 's) +(require 'compat) (require 'citeproc-s) (require 'citeproc-lib) @@ -148,7 +149,7 @@ If optional SKIP-NOCASE is non-nil then skip spans with the (defun citeproc-rt-strip-periods (rts) "Remove all periods from rich-texts RTS." - (citeproc-rt-map-strings (lambda (x) (citeproc-s-replace "." "" x)) rts)) + (citeproc-rt-map-strings (lambda (x) (string-replace "." "" x)) rts)) (defun citeproc-rt-length (rt) "Return the length of rich-text RT as a string." @@ -532,12 +533,6 @@ The values are ordered depth-first." ;;; Helpers for bibliography rendering -(defun citeproc-rt-max-offset (itemdata) - "Return the maximal first field width in rich-texts RTS." - (cl-loop for itd being the hash-values of itemdata - when (listp (citeproc-itemdata-rawbibitem itd)) maximize - (length (citeproc-rt-to-plain (cadr (citeproc-itemdata-rawbibitem itd)))))) - (defun citeproc-rt-subsequent-author-substitute (bib s) "Substitute S for subsequent author(s) in BIB. BIB is a list of bib entries in rich-text format. Return the diff --git a/elpa/citeproc-20230228.1414/citeproc-s.el b/elpa/citeproc-20240722.1110/citeproc-s.el similarity index 93% rename from elpa/citeproc-20230228.1414/citeproc-s.el rename to elpa/citeproc-20240722.1110/citeproc-s.el index bfb62083..88d58663 100644 --- a/elpa/citeproc-20230228.1414/citeproc-s.el +++ b/elpa/citeproc-20240722.1110/citeproc-s.el @@ -27,11 +27,7 @@ (require 'thingatpt) (require 's) - -;; Handle the unavailability of `string-replace' in early Emacs versions -(if (fboundp 'string-replace) - (defalias 'citeproc-s-replace #'string-replace) - (defalias 'citeproc-s-replace #'s-replace)) +(require 'compat) (defun citeproc-s-camelcase-p (s) "Return whether string S is in camel case." @@ -151,12 +147,12 @@ first word is not in lowercase then return S." (buffer-string)) s)) -(defun citeproc-s-sentence-case-title (s omit-nocase) +(defun citeproc-s-sentence-case-title (s &optional omit-nocase) "Return a sentence-cased version of title string S. If optional OMIT-NOCASE is non-nil then omit the nocase tags from the output." (if (s-blank-p s) s (let ((sliced (citeproc-s-slice-by-matches - s "\\(\\|\\|: +\\w\\)")) + s "\\(\\|\\|: +[\"'“‘]*[[:alpha:]]\\)")) (protect-level 0) (first t) result) @@ -165,13 +161,18 @@ If optional OMIT-NOCASE is non-nil then omit the nocase tags from the output." (pcase slice ("" (cl-incf protect-level) (if omit-nocase nil slice)) ("" (cl-decf protect-level) (if omit-nocase nil slice)) - ;; Don't touch the first letter after a colon since it is probably a subtitle. - ((pred (string-match-p "^:")) slice) + ;; Don't touch the first letter after a colon since it probably + ;; starts a subtitle. + ((pred (string-match-p "^: +[\"'“‘]*[[:alpha:]]")) (setq first nil) slice) (_ (cond ((< 0 protect-level) (setq first nil) slice) ((not first) (downcase slice)) (t (setq first nil) - (concat (upcase (substring slice 0 1)) - (downcase (substring slice 1))))))) + ;; We upcase the first letter and downcase the rest. + (let ((pos (string-match "[[:alpha:]]" slice))) + (if pos (concat (substring slice 0 pos) + (upcase (substring slice pos (1+ pos))) + (downcase (substring slice (1+ pos)))) + slice)))))) result)) (apply #'concat (nreverse result))))) @@ -232,7 +233,7 @@ OQ is the opening quote, CQ is the closing quote to use." REPLACEMENTS is an alist with (FROM . TO) elements." (let ((result s)) (pcase-dolist (`(,from . ,to) replacements) - (setq result (citeproc-s-replace from to result))) + (setq result (string-replace from to result))) result)) (defun citeproc-s-replace-all-sim (s regex replacements) diff --git a/elpa/citeproc-20230228.1414/citeproc-sort.el b/elpa/citeproc-20240722.1110/citeproc-sort.el similarity index 95% rename from elpa/citeproc-20230228.1414/citeproc-sort.el rename to elpa/citeproc-20240722.1110/citeproc-sort.el index 12bdb685..4de98d9b 100644 --- a/elpa/citeproc-20230228.1414/citeproc-sort.el +++ b/elpa/citeproc-20240722.1110/citeproc-sort.el @@ -36,6 +36,7 @@ (require 'citeproc-macro) (require 'citeproc-proc) (require 'citeproc-name) +(require 'citeproc-number) (defun citeproc--sort (_attrs _context &rest body) "Placeholder function corresponding to the cs:sort element of CSL." @@ -172,17 +173,17 @@ MODE is either `cite' or `bib'." (let ((is-sorted-bib (citeproc-style-bib-sort (citeproc-proc-style proc))) (is-filtered (citeproc-proc-filtered-bib-p proc))) (when (or is-sorted-bib is-filtered) - (let* ((itds (hash-table-values (citeproc-proc-itemdata proc))) - (sorted (if is-sorted-bib - (let ((sort-orders (citeproc-style-bib-sort-orders + (let* ((itds (citeproc-sort-itds-on-citnum + (hash-table-values (citeproc-proc-itemdata proc))))) + (when is-sorted-bib + (let ((sort-orders (citeproc-style-bib-sort-orders (citeproc-proc-style proc)))) - (citeproc-sort-itds itds sort-orders)) - (citeproc-sort-itds-on-citnum itds)))) + (setq itds (citeproc-sort-itds itds sort-orders)))) ;; Additionally sort according to subbibliographies if there are filters. (when is-filtered - (setq sorted (sort sorted #'citeproc-sort-itds-on-subbib))) + (setq itds (sort itds #'citeproc-sort-itds-on-subbib))) ;; Set the CSL citation-number field according to the sort order. - (--each-indexed sorted + (--each-indexed itds (citeproc-itd-setvar it 'citation-number (number-to-string (1+ it-index)))))))) diff --git a/elpa/citeproc-20230228.1414/citeproc-style.el b/elpa/citeproc-20240722.1110/citeproc-style.el similarity index 94% rename from elpa/citeproc-20230228.1414/citeproc-style.el rename to elpa/citeproc-20240722.1110/citeproc-style.el index e7dd4c78..32f6c30f 100644 --- a/elpa/citeproc-20230228.1414/citeproc-style.el +++ b/elpa/citeproc-20240722.1110/citeproc-style.el @@ -37,6 +37,7 @@ (cl-defstruct (citeproc-style (:constructor citeproc-style--create)) "A struct representing a parsed and localized CSL style. +CATEGORY is the style's category as a string, INFO is the style's general info (currently simply the corresponding fragment of the parsed xml), OPTS, BIB-OPTS, CITE-OPTS and LOCALE-OPTS are alists of general @@ -49,7 +50,6 @@ BIB-SORT-ORDERS and CITE-SORT-ORDERS are the lists of sort orders the n-th key should be in ascending or desending order, CITE-LAYOUT-ATTRS contains the attributes of the citation layout as an alist, -CITE-NOTE is non-nil iff the style's citation-format is \"note\", DATE-TEXT and DATE-NUMERIC are the style's date formats, LOCALE contains the locale to be used or nil if not set, MACROS is an alist with macro names as keys and corresponding @@ -57,8 +57,8 @@ MACROS is an alist with macro names as keys and corresponding TERMS is the style's parsed term-list, USES-YS-VAR is non-nil iff the style uses the YEAR-SUFFIX CSL-variable." - info opts bib-opts bib-sort bib-sort-orders - bib-layout cite-opts cite-note cite-sort cite-sort-orders + category info opts bib-opts bib-sort bib-sort-orders + bib-layout cite-opts cite-sort cite-sort-orders cite-layout cite-layout-attrs locale-opts macros terms uses-ys-var date-text date-numeric locale) @@ -98,12 +98,13 @@ in-style locale information will be loaded (if available)." (--each (cddr parsed-style) (pcase (car it) ('info - (let ((info-lst (cddr it))) - (setf (citeproc-style-info style) info-lst - (citeproc-style-cite-note style) - (not (not (member '(category - ((citation-format . "note"))) - info-lst)))))) + (let* ((info-lst (cddr it)) + (category-info (cl-find-if + (lambda (x) (and (eq 'category (car x)) + (eq 'citation-format (caaadr x)))) + info-lst)) + (category (cdaadr category-info))) + (setf (citeproc-style-category style) category))) ('locale (let ((lang (alist-get 'lang (cadr it)))) (when (and (citeproc-locale--compatible-p lang locale) @@ -310,7 +311,16 @@ position and before the (possibly empty) body." (cons str (cdr result))) result))) ;; Handle `author' citation mode by stopping if needed - (citeproc-lib-maybe-stop-rendering 'names context final))))) + (citeproc-context-maybe-stop-rendering 'names context final))))) + +(defun citeproc-style-cite-note (style) + "Return whether csl STYLE is a note style." + (string= (citeproc-style-category style) "note")) + +(defun citeproc-style-cite-superscript-p (style) + "Return whether csl STYLE has a superscript citaton layout." + (string= (alist-get 'vertical-align (citeproc-style-cite-layout-attrs style)) + "sup")) (defun citeproc-style-global-opts (style layout) "Return the global opts in STYLE for LAYOUT. diff --git a/elpa/citeproc-20230228.1414/citeproc-subbibs.el b/elpa/citeproc-20240722.1110/citeproc-subbibs.el similarity index 95% rename from elpa/citeproc-20230228.1414/citeproc-subbibs.el rename to elpa/citeproc-20240722.1110/citeproc-subbibs.el index 4379e676..1109081f 100644 --- a/elpa/citeproc-20230228.1414/citeproc-subbibs.el +++ b/elpa/citeproc-20240722.1110/citeproc-subbibs.el @@ -25,6 +25,8 @@ ;;; Code: +(require 'subr-x) +(require 'compat) (require 'dash) (require 'citeproc-proc) @@ -39,7 +41,8 @@ see the documentation of `citeproc-add-subbib-filters'." (let* ((csl-type (alist-get 'type vv)) (type (or (alist-get 'blt-type vv) csl-type)) (keyword (alist-get 'keyword vv)) - (keywords (and keyword (split-string keyword "[ ,;]" t)))) + (keywords (and keyword (mapcar #'string-clean-whitespace + (split-string keyword "[,;]" t))))) (--every-p (pcase it (`(type . ,key) (string= type key)) diff --git a/elpa/citeproc-20230228.1414/citeproc-term.el b/elpa/citeproc-20240722.1110/citeproc-term.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-term.el rename to elpa/citeproc-20240722.1110/citeproc-term.el diff --git a/elpa/citeproc-20230228.1414/citeproc-test-human.el b/elpa/citeproc-20240722.1110/citeproc-test-human.el similarity index 100% rename from elpa/citeproc-20230228.1414/citeproc-test-human.el rename to elpa/citeproc-20240722.1110/citeproc-test-human.el diff --git a/elpa/citeproc-20230228.1414/citeproc.el b/elpa/citeproc-20240722.1110/citeproc.el similarity index 95% rename from elpa/citeproc-20230228.1414/citeproc.el rename to elpa/citeproc-20240722.1110/citeproc.el index 0a930bae..c8648b4f 100644 --- a/elpa/citeproc-20230228.1414/citeproc.el +++ b/elpa/citeproc-20240722.1110/citeproc.el @@ -1,13 +1,14 @@ ;;; citeproc.el --- A CSL 1.0.2 Citation Processor -*- lexical-binding: t; -*- -;; Copyright (C) 2017-2023 András Simonyi +;; Copyright (C) 2017-2024 András Simonyi ;; Author: András Simonyi ;; Maintainer: András Simonyi ;; URL: https://github.com/andras-simonyi/citeproc-el ;; Keywords: bib -;; Package-Requires: ((emacs "26") (dash "2.13.0") (s "1.12.0") (f "0.18.0") (queue "0.2") (string-inflection "1.0") (org "9") (parsebib "2.4")) -;; Version: 0.9.3 +;; Package-Requires: ((emacs "26") (dash "2.13.0") (s "1.12.0") (f "0.18.0") (queue "0.2") (string-inflection "1.0") (org "9") (parsebib "2.4")(compat "28.1")) +;; Package-Version: 20240722.1110 +;; Package-Revision: 54184baaff55 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -87,10 +88,12 @@ CITATIONS is a list of `citeproc-citation' structures." (new-ids (--remove (gethash it itemdata) uniq-ids))) ;; Add all new items in one pass (citeproc-proc-put-items-by-id proc new-ids) - ;; Add itemdata to the cite structs and add them to the cite queue. + ;; Internalize the cites dealing with locator-extra if present, add itemdata to + ;; the cite structs and add them to the cite queue. (dolist (citation citations) (setf (citeproc-citation-cites citation) - (--map (cons (cons 'itd (gethash (alist-get 'id it) itemdata)) it) + (--map (cons (cons 'itd (gethash (alist-get 'id it) itemdata)) + (citeproc-cite--internalize-locator it)) (citeproc-citation-cites citation))) (queue-append (citeproc-proc-citations proc) citation)) (setf (citeproc-proc-finalized proc) nil)))) @@ -239,8 +242,12 @@ formatting parameters keyed to the parameter names as symbols: raw-bib) raw-bib)) ;; Calculate formatting params. - (max-offset (if (alist-get 'second-field-align bib-opts) - (citeproc-rt-max-offset itemdata) + ;; NOTE: This is the only place where we check whether there are + ;; bibliography items in the processor, even though the empty case + ;; could be handled way more efficiently. + (max-offset (if (and (alist-get 'second-field-align bib-opts) + (not (hash-table-empty-p itemdata))) + (citeproc-proc-max-offset itemdata) 0)) (format-params (cons (cons 'max-offset max-offset) (citeproc-style-bib-opts-to-formatting-params bib-opts))) -- 2.47.3