summaryrefslogtreecommitdiff
path: root/parsebib.el
diff options
context:
space:
mode:
authorJoost Kremers <joostkremers@fastmail.fm>2021-05-06 17:42:48 +0200
committerJoost Kremers <joostkremers@fastmail.fm>2021-05-06 17:42:48 +0200
commit0e075917e3c73c7da80e6d5e1119c149fd447b82 (patch)
tree47b389aa8dc058ce7a3334d3bcdc83be4d6b5054 /parsebib.el
parent25f66ce2e529fa16af57de0921abc9cb3c0838bb (diff)
Add some comments and empty lines to parsebib-stringify-json-field
Diffstat (limited to 'parsebib.el')
-rw-r--r--parsebib.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/parsebib.el b/parsebib.el
index fd1db42..ce33cfd 100644
--- a/parsebib.el
+++ b/parsebib.el
@@ -787,14 +787,24 @@ string."
(cond
((stringp value)
value)
+
((numberp value)
(format "%s" value))
+
((memq key parsebib-json-name-fields)
(parsebib--json-stringify-name-field value))
+
((memq key parsebib-json-date-fields)
(parsebib--json-stringify-date-field value))
+
+ ;; In CSL-JSON v1.0, the only array field besides name and date fields
+ ;; is "categories". It has an array of strings as value, so the `format'
+ ;; isn't strictly necessary. We do it this way just to be on the safe
+ ;; side.
((arrayp value)
(mapconcat (lambda (e) (format "%s" e)) value parsebib-json-field-separator))
+
+ ;; This clause should never be reached.
(t (replace-regexp-in-string "\n" " " (format "%s" value))))))
(defun parsebib--json-stringify-name-field (names)