feat: Add option to preserve TeX markup in cache #865
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
withciteproc-el
, titles and other fields may not be capitalized correctly. This is becausecitar
's caching mechanism, which usesparsebib-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
.nil
(the default),citar
maintains the existing behavior of stripping TeX markup.t
,citar
preserves TeX markup by passing:display nil
toparsebib-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
orauthor
). 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.