summaryrefslogtreecommitdiff
path: root/lisp/org/oc-basic.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2022-02-28 06:33:06 +0100
committerStefan Kangas <stefan@marxist.se>2022-02-28 06:33:06 +0100
commit1de7382b574ff9f40319d7a075d952cb944f96ca (patch)
treefef42473b64f82156f803cbc42f5bc588c49eb8c /lisp/org/oc-basic.el
parent0f3ce51a0d5f2aabad3d3aeb3d86d52b152deef0 (diff)
parente77fc8262ad73f30b1983f403262dce6f0e4cb09 (diff)
downloademacs-1de7382b574ff9f40319d7a075d952cb944f96ca.tar.gz
emacs-1de7382b574ff9f40319d7a075d952cb944f96ca.tar.bz2
emacs-1de7382b574ff9f40319d7a075d952cb944f96ca.zip
Merge from origin/emacs-28
e77fc8262a Update to Org 9.5.2-22-g33543d 9bce4b67f1 ; * lisp/help.el (with-help-window): Doc fix. (Bug#54170) 558b03a958 Add explicit '--no-heading' for ripgrep
Diffstat (limited to 'lisp/org/oc-basic.el')
-rw-r--r--lisp/org/oc-basic.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el
index d82406affb2..81b7e4471fd 100644
--- a/lisp/org/oc-basic.el
+++ b/lisp/org/oc-basic.el
@@ -178,21 +178,29 @@ Return a hash table with citation references as keys and fields alist as values.
" and ")))
('issued
;; Date are expressed as an array
- ;; (`date-parts') or a "string (`raw').
- ;; In both cases, extract the year and
- ;; associate it to `year' field, for
- ;; compatibility with BibTeX format.
+ ;; (`date-parts') or a "string (`raw'
+ ;; or `literal'). In both cases,
+ ;; extract the year and associate it
+ ;; to `year' field, for compatibility
+ ;; with BibTeX format.
(let ((date (or (alist-get 'date-parts value)
+ (alist-get 'literal value)
(alist-get 'raw value))))
(cons 'year
(cond
((consp date)
(caar date))
((stringp date)
- (car (split-string date "-")))
+ (replace-regexp-in-string
+ (rx
+ (minimal-match (zero-or-more anything))
+ (group-n 1 (repeat 4 digit))
+ (zero-or-more anything))
+ (rx (backref 1))
+ date))
(t
(error "Unknown CSL-JSON date format: %S"
- date))))))
+ value))))))
(_
(cons field value))))
item)