From e89c7872d8c287fb3affd9c815a1423b366c2bb9 Mon Sep 17 00:00:00 2001 From: Andras Simonyi Date: Wed, 19 Jun 2024 08:26:19 +0200 Subject: [PATCH] oc-csl: New custom option `org-cite-csl-bibtex-titles-to-sentence-case' * lisp/oc-csl.el (org-cite-csl-bibtex-titles-to-sentence-case): New variable. (org-cite-csl--processor): Create the itemgetter using the new option. * etc/ORG-NEWS (New option ~org-cite-csl-bibtex-titles-to-sentence-case~): Announce the change. --- etc/ORG-NEWS | 11 +++++++++++ lisp/oc-csl.el | 21 ++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index b81dabb15..78a60382d 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -61,6 +61,17 @@ The default value used to be pulled from =dvipng= process type from =latexmk= (when available), or running =latex= multiple times, so that all the references are resolved in the generated png. +*** New option ~org-cite-csl-bibtex-titles-to-sentence-case~ + +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 default value is ~t~ as the CSL standard assumes that +English titles are specified in sentence-case but the bibtex +bibliography format requires them to be written in title-case. + ** New functions and changes in function arguments # This also includes changes in function behavior from Elisp perspective. diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index b8691bf6f..338f72e9d 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -321,6 +321,24 @@ in the bibliography measured in characters." :type 'string :package-version '(Org . "9.7")) +(defcustom org-cite-csl-bibtex-titles-to-sentence-case 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, title conversion is limited to +entries having a `langid' field specifying a variant of English. + +Conversion of titles to sentence-case by default is in most cases +useful because the CSL standard assumes that English titles are +specified in sentence-case but the bibtex bibliography format +requires them to be written in title-case." + :group 'org-cite + :package-version '(Org . "9.8") + :type 'boolean + :safe #'booleanp) + ;;; Internal variables (defconst org-cite-csl--etc-dir @@ -579,7 +597,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-bibtex-titles-to-sentence-case)) (org-cite-csl--locale-getter) locale))) (plist-put info :cite-citeproc-processor processor) -- 2.34.1