aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/org/oc-basic.el
diff options
context:
space:
mode:
authorKyle Meyer2022-02-28 00:11:01 -0500
committerKyle Meyer2022-02-28 00:11:01 -0500
commite77fc8262ad73f30b1983f403262dce6f0e4cb09 (patch)
tree7c0b1c6e4d59104fed469090dc253675d4e1ba6b /lisp/org/oc-basic.el
parent9bce4b67f1770e288a16b44478f1a6dfdc1fc177 (diff)
downloademacs-e77fc8262ad73f30b1983f403262dce6f0e4cb09.tar.gz
emacs-e77fc8262ad73f30b1983f403262dce6f0e4cb09.zip
Update to Org 9.5.2-22-g33543d
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.
178 " and "))) 178 " and ")))
179 ('issued 179 ('issued
180 ;; Date are expressed as an array 180 ;; Date are expressed as an array
181 ;; (`date-parts') or a "string (`raw'). 181 ;; (`date-parts') or a "string (`raw'
182 ;; In both cases, extract the year and 182 ;; or `literal'). In both cases,
183 ;; associate it to `year' field, for 183 ;; extract the year and associate it
184 ;; compatibility with BibTeX format. 184 ;; to `year' field, for compatibility
185 ;; with BibTeX format.
185 (let ((date (or (alist-get 'date-parts value) 186 (let ((date (or (alist-get 'date-parts value)
187 (alist-get 'literal value)
186 (alist-get 'raw value)))) 188 (alist-get 'raw value))))
187 (cons 'year 189 (cons 'year
188 (cond 190 (cond
189 ((consp date) 191 ((consp date)
190 (caar date)) 192 (caar date))
191 ((stringp date) 193 ((stringp date)
192 (car (split-string date "-"))) 194 (replace-regexp-in-string
195 (rx
196 (minimal-match (zero-or-more anything))
197 (group-n 1 (repeat 4 digit))
198 (zero-or-more anything))
199 (rx (backref 1))
200 date))
193 (t 201 (t
194 (error "Unknown CSL-JSON date format: %S" 202 (error "Unknown CSL-JSON date format: %S"
195 date)))))) 203 value))))))
196 (_ 204 (_
197 (cons field value)))) 205 (cons field value))))
198 item) 206 item)