Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

citationNoteNum wrong when there are references to example list items #6836

Open
jgm opened this issue Nov 14, 2020 · 2 comments
Open

citationNoteNum wrong when there are references to example list items #6836

jgm opened this issue Nov 14, 2020 · 2 comments

Comments

@jgm
Copy link
Owner

jgm commented Nov 14, 2020

Example, bug.md:

[@buchanan:puzzle]

(@foo)

See @foo.

[@buchanan:puzzle]

[@vontfintel:foo]

[@vonfintel:foo]

Output of pandoc bug.md -t native:

[Para [Cite [Citation {citationId = "buchanan:puzzle", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 1, citationHash = 0}] [Str "[@buchanan:puzzle]"]]
,OrderedList (1,Example,TwoParens)
 [[]]
,Para [Str "See",Space,Str "1."]
,Para [Cite [Citation {citationId = "buchanan:puzzle", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 3, citationHash = 0}] [Str "[@buchanan:puzzle]"]]
,Para [Cite [Citation {citationId = "vontfintel:foo", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 4, citationHash = 0}] [Str "[@vontfintel:foo]"]]
,Para [Cite [Citation {citationId = "vonfintel:foo", citationPrefix = [], citationSuffix = [], citationMode = NormalCitation, citationNoteNum = 5, citationHash = 0}] [Str "[@vonfintel:foo]"]]]

Note how citationNoteNum jumps from 1 to 3, and the second citation gets note number 3.
Removing the reference See @foo prevents the problem. This bug leads to incorrect position calculation in citeproc and missing "ibid" in some cases.

@jgm
Copy link
Owner Author

jgm commented Nov 14, 2020

This happens because note number calculation occurs before we know whether @foo is a citation or an example number reference.

jgm added a commit that referenced this issue Nov 14, 2020
Background:  syntactically, references to example list items
can't be distinguished from citations; we only know which they
are after we've parsed the whole document (and this is resolved
in the `runF` stage).

This means that pandoc's calculation of `citationNoteNum`
can sometimes be wrong when there are example list references.

This commit partially addresses #6836, but only for the case
where the example list references refer to list items defined
previously in the document.
@jgm
Copy link
Owner Author

jgm commented Nov 14, 2020

The issue is partially resolved, but only for the case where the example list references refer to example list items earlier in the document (not later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant