From 031428611c18bb4d97bbdbd11a7549ca2b96ccec Mon Sep 17 00:00:00 2001 From: Andras Simonyi Date: Sat, 11 May 2024 11:20:41 +0200 Subject: [PATCH] oc-csl: New custom option `org-cite-csl-sentence-case-bibtex-titles' * lisp/oc-csl.el (org-cite-csl-sentence-case-bibtex-titles): New variable. (org-cite-csl--processor): Create the itemgetter using the new option. * etc/ORG-NEWS (New option ~org-cite-csl-sentence-case-bibtex-titles~): Announce the change. --- etc/ORG-NEWS | 9 +++++++++ lisp/oc-csl.el | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 36eeddda1..9ca71d0a2 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -1128,6 +1128,15 @@ blocks that do not specify any ~:formatter~ parameter. Its default value (the new function ~org-columns-dblock-write-default~) yields the previous (fixed) formatting behaviour. +*** New option ~org-cite-csl-sentence-case-bibtex-titles~ + +When this option is non-nil then title fields in bibtex bibliography +entries are converted to sentence-case before being formatted +according to a CSL style, except for entries with a =langid= field +specifying a non-English language. When nil, this conversion is +limited to entries having a =langid= field specifying a variant of +English. The defult value is ~t~. + ** New features *** =ob-lua=: Support all types and multiple values in results diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index 9bbe5e29d..7234174d0 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -321,6 +321,21 @@ in the bibliography measured in characters." :type 'string :package-version '(Org . "9.7")) +(defcustom org-cite-csl-sentence-case-bibtex-titles t + "Convert bibtex title fields to sentence-case by default. + +When non-nil, title fields in bibtex bibliography entries are +converted to sentence-case before being formatted according to a +CSL style, except for entries with a `langid' field specifying a +non-English language. + +When nil, this conversion is limited to entries having a `langid' +field specifying a variant of English." + :group 'org-cite + :package-version '(Org . "9.7") + :type 'boolean + :safe #'booleanp) + ;;; Internal variables (defconst org-cite-csl--etc-dir @@ -584,7 +599,8 @@ property in INFO." (processor (citeproc-create (org-cite-csl--style-file info) - (citeproc-hash-itemgetter-from-any bibliography) + (citeproc-hash-itemgetter-from-any + bibliography (not org-cite-csl-sentence-case-bibtex-titles)) (org-cite-csl--locale-getter) locale))) (plist-put info :cite-citeproc-processor processor) -- 2.34.1