jgm/pandoc

Minus sign prefix stripped from citation and does not appear in json

tomduck opened this issue · 6 comments

Consider the following test.md:

 -@foo

Processing with pandoc test.md -t json gives

[{"unMeta":{}},[{"t":"Para","c":[{"t":"Cite","c":[[{"citationSuffix":[],"citationNoteNum":0,"citationMode":{"t":"AuthorInText","c":[]},"citationPrefix":[],"citationId":"foo","citationHash":0}],[{"t":"Str","c":"@foo"}]]}]}]]

Now, consider the following test.md with the minus sign having been dropped:

 @foo

Processing with pandoc test.md -t json gives exactly the same json as above.

It seems to me that since the files are different, the json should also be different.

This Issue is of interest for my pandoc-fignos/eqnos/tablenos filters. I would like to use the minus sign to modify the referencing behaviour for figures/equations/tables. I can (and will) use other characters, but the semantic meaning of the minus sign is clearer.

jgm commented

The citationMode field in Citation can be either NormalCitation, SuppressAuthor, or AuthorInText (exclusive and exhaustive alternatives). When you have an unbracketed citation like @foo, that sets AuthorInText, so there's no way to set SuppressAuthor in addition. And indeed, SuppressAuthor and AuthorInText would seem to be incompatible. So the - is just ignored when you have an author in text citation.

OK, thanks. But it doesn't make sense to me that the - should be ignored. Why not include it as a Str element right before the Cite in the value list?

... or, alternatively, put it in the "citationPrefix" field?

jgm commented

Given that the combination of - with an author-in-text
citation doesn't make sense anyway, I'm not sure either
behavior "makes sense" more than the other. It would be
confusing to some to see the - appear as literal in some
contexts and be interpreted as a syntactic marker in others.

I know you want to use this syntactic construct for other
purposes, for which it would be useful if pandoc made a
distinction here, but I can't let that guide the choice
here.

+++ Thomas J. Duck [May 07 16 20:27 ]:

OK, thanks. But it doesn't make sense to me that the - should be
ignored. Why not include it as a Str element right before the Cite in
the value list?


You are receiving this because you modified the open/close state.
Reply to this email directly or [1]view it on GitHub

References

  1. #2901 (comment)

Thanks for the explanation, John. An Ignored element might be useful here.

Note that an Ignored element could be filtered out before it reaches the writers. This would limit the required changes.