feat: Add option to preserve TeX markup in cache
NB: the PR is not ready to be merged. Please read below for a description of the required additional changes.
The PR introduces a new user option, citar-cache-preserve-markup, to control whether TeX markup is preserved in bibliography fields when populating the Citar cache. This helps address issues with incorrect capitalization in formatted references, as reported in #784.
Problem
When using citar-insert-reference with citeproc-el, titles and other fields may not be capitalized correctly. This is because citar's caching mechanism, which uses parsebib-parse, strips TeX markup by default. For example, a title like {Can humans be the {FORTRAN} of creatures?} becomes "Can humans be the fortran of creatures?", losing the intended capitalization of "FORTRAN".
Solution
This change introduces a new boolean custom variable, citar-cache-preserve-markup.
- When
nil(the default),citarmaintains the existing behavior of stripping TeX markup. - When
t,citarpreserves TeX markup by passing:display niltoparsebib-parse.
The cache invalidation logic has also been updated. The cache will now be rebuilt if the value of citar-cache-preserve-markup changes, ensuring that the cached entries reflect the user's current setting.
Known Issues
Preserving markup across all fields can have side effects on downstream processors like citeproc-el, which may not expect markup in certain fields (e.g., date or author). This can lead to parsing errors or incorrect formatting for those fields.
This change provides a way to solve the capitalization issue, but a full solution requires improvements to the parsers in citeproc-el. Since I don’t understand the inner workings of this other package, I am not able to implement those changes myself.
I'll take a look at this soon, but note that the CI check is failing currently, and you can convert this to a draft to indicate it's "not ready" status.
I didn't know about the ‘draft’ option, thanks.