From: "András Simonyi" <andras.simonyi@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] oc-csl: New custom option `org-cite-csl-sentence-case-bibtex-titles'
Date: Wed, 19 Jun 2024 11:27:14 +0200 [thread overview]
Message-ID: <CAOWRwxDqLyYUr-dyMFDUcZJUajbpLQ9Y5=2PZeJH-zFdBb=kxA@mail.gmail.com> (raw)
In-Reply-To: <CAOWRwxBWXnPR6dz=6=PeiiX8ZR=VuOi6_cQsx99OwvRoAnyngQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3051 bytes --]
Dear Ihor and Max,
thanks for the feedback and apologies for responding that late.
On Wed, 15 May 2024 at 13:48, Max Nikulin <manikulin@gmail.com> wrote:
> Is it possible to keep title formatting from .bib files till it becomes
> known that specific style requires sentence case for particular entry
> type? I had a hope that it might alleviate the issue and to make things
> working out of the box for more users.
The problem is that many (maybe most) CSL styles simply assume that
titles are in sentence-case in the input without
making this explicit. The APA citation style is a prominent example:
the APA guidelines require sentence-case titles but
AFAICS the standard CSL implementations do not encode this explicitly.
Of course it could be checked whether
a CSL style contains explicit instructions about how to format titles
and skip sentence-case conversion of input for those but this
probably would not
solve the problems of users who do not want the conversion at all.
> > I'm a bit unsure about naming the option:
> > Perhaps `org-cite-csl-sentence-case-bibtex-titles-without-langid'
>
> A variant: org-cite-csl-bibtex-title-to-sentence-case
thanks, in the attached patch I went with (a slightly modified version of) this.
> Does it means that you added one more argument to `citeproc-create' and
> that consistent Org and citeproc-el versions must be used?
no, at least in the sense that this argument has been there since 2021.
> It may be tricky to preserve
> backward-forward compatibility on this step, but it should make further
> changes easier. It may be reasonable to explicitly add version of
> "protocol" to the property list, so that citeproc-el may decide if error
> should be signaled in the case of serious version difference.
although I don't think backward compatibility could be a problem in
that particular case, in the future
a mechanism like this might be useful, so I plan to implement it,
thanks for the suggestion.
> It is not clear for me why `org-cite-csl-sentence-case-bibtex-titles' is
> a part of Org, not of citeproc-el. The only thing that Org can do is to
> pass it to citeproc-el. It is not configurable per .org file and likely
> it should not be. From my point of view it might be more suitable per
> .bib file. Anyway it is almost unrelated to Org.
citeproc-el doesn't have customizable user options by design because
it was conceived as a relatively low level
rendering library. Also, it's used by several user-facing packages by
now in addition to Org (org-ref, citar etc.) so
I think it would be both confusing and difficult to try to keep this
type of customizations in the library.
> On Mon, 17 Jun 2024 at 13:37, Ihor Radchenko <yantar92@posteo.net> wrote:
> > > Also, it would be nice to point out the CSL and Bibtex have different> > > conventions for the title field.
I added a few words about this now both in the docstring and in the
ORG-NEWS entry -- I've attached
the updated patch.
best wishes,
András
[-- Attachment #2: 0001-oc-csl-New-custom-option-org-cite-csl-bibtex-titles-.patch --]
[-- Type: text/x-patch, Size: 3251 bytes --]
From e89c7872d8c287fb3affd9c815a1423b366c2bb9 Mon Sep 17 00:00:00 2001
From: Andras Simonyi <andras.simonyi@gmail.com>
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)
+
\f
;;; 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
next prev parent reply other threads:[~2024-06-19 9:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-11 15:33 [PATCH] oc-csl: New custom option `org-cite-csl-sentence-case-bibtex-titles' András Simonyi
2024-05-11 17:26 ` Ihor Radchenko
2024-05-14 9:58 ` András Simonyi
2024-05-17 13:34 ` Ihor Radchenko
2024-06-17 11:39 ` Ihor Radchenko
2024-06-18 15:52 ` András Simonyi
2024-06-19 9:27 ` András Simonyi [this message]
2024-06-19 14:36 ` Ihor Radchenko
2024-06-20 5:56 ` András Simonyi
2024-06-21 10:27 ` Max Nikulin
2024-05-15 11:48 ` Max Nikulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOWRwxDqLyYUr-dyMFDUcZJUajbpLQ9Y5=2PZeJH-zFdBb=kxA@mail.gmail.com' \
--to=andras.simonyi@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).