andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
85 stars 9 forks source link

Best practices for spaces and punctuation in prefix, suffix, etc. #50

Open jkitchin opened 3 years ago

jkitchin commented 3 years ago

Suppose (using org-cite syntax) I have [cite:See @key on page 1, for example]

I guess this would look like this. My question is, should there be a space in the prefix at the end or should it be trimmed (it doesn't seem to matter, but...), similarly if there is space in the suffix at the beginning, should it be trimmed or not (likewise, it seems like it doesn't matter, in these?

I gather that the label must be trimmed because " page " does not match somewhere, and the p. is lost if there are spaces before or after the label.

#+BEGIN_SRC emacs-lisp :var tangled=(org-babel-tangle)
(let* ((proc (citeproc-create "apa-5th-edition.csl"
                  (citeproc-itemgetter-from-bibtex "test.bib")
                  (citeproc-locale-getter-from-dir ".")
                  "en-US"))
       (cites (list (citeproc-citation-create :cites '(((id . "kitchin-2015-examp-effec")
                            (prefix . "See ")
                            (suffix . ", for example")
                            (locator . "1")
                            (label . "page")
                            (suppress-author)))
                          :mode 'nil
                          :capitalize-first nil
                          :suppress-affixes nil)))
       (rendered-citations (progn (citeproc-append-citations cites proc)
                  (citeproc-render-citations proc 'plain nil))))
  (car rendered-citations))
#+END_SRC

#+RESULTS:
: (See Kitchin, 2015, p. 1 , for example)

Also , You can see there is an extra space after the locator, and before the , that I put in the suffix. Is that a bug? It disappears if I take out the comma.