Extract citationSuffix, citationPrefix. #11009
Open
+101
−23
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.
In transforming pandoc Cite to citeproc Citation,
extract a
citationSuffix
andcitationPrefix
from the last item's suffix and first item's prefix, respectively, if they contain a|
character which separates the item's suffix or prefix from the whole Citation's.for example:
Here "for example, see" acts as a prefix for the whole group and will remain at the beginning even if the citation items are reordered by citeproc. Similarly, ", and others" will be a suffix for the whole group.
The terminology is confusing, because a pandoc Citation is a citeproc CitationItem, and a pandoc Cite (which can contain multiple Citations) is a citeproc Citation. A citeproc
citationPrefix
is a prefix on the whole group of items.Closes #10894.
Notes:
The org reader now adds global prefixes and suffixes the same way as the Markdown reader: as affixes to the first item's prefix or the last item's suffix, separated by a pipe (
|
).The org writer, however, has not been modified to convert the
|
to a;
, as required by org-cite syntax.This change doesn't currently do what one would expect, because of changes that were made to citeproc to prevent citation items with prefixes and suffixes from being sorted. Hence in
test/command/10894.md
, we have test outputwithout affixes, but
with affixes. To make this work well, we'd need to remove the citeproc code that prevented bad results before we had proper global prefixes and suffixes. However, removing this code would mean that existing documents would render differently, unless the new pipe syntax for citation affixes were used. That may be something we want to avoid.
The use of pipes to separate out global affixes from item-level affixes is a kludge that could be avoided if we added additional fields to Cite in the pandoc AST. However, AST changes are disruptive, so perhaps it's not worth doing that.