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

Pandoc 2.19.2 parses a citation preceded by an exclamation point as AuthorInText #8254

Closed
fiapps opened this issue Aug 28, 2022 · 2 comments
Closed
Labels

Comments

@fiapps
Copy link

fiapps commented Aug 28, 2022

I expect "Wow![@legras_michel_2010]" to be parsed as the string "Wow!" followed by a normal citation, but pandoc 2.19.2 unexpectedly parses the citation as an AuthorInText in square brackets, and drops the exclamation point.

MWE:

% echo 'Wow![@legras_michel_2010]' | pandoc -t native
[ Para
    [ Str "Wow["
    , Cite
        [ Citation
            { citationId = "legras_michel_2010"
            , citationPrefix = []
            , citationSuffix = []
            , citationMode = AuthorInText
            , citationNoteNum = 2
            , citationHash = 0
            }
        ]
        [ Str "@legras_michel_2010" ]
    , Str "]"
    ]
]

Workaroud: If the exclamation mark is escaped, it works as expected.

% echo 'Wow\![@legras_michel_2010]' | pandoc -t native
[ Para
    [ Str "Wow!"
    , Cite
        [ Citation
            { citationId = "legras_michel_2010"
            , citationPrefix = []
            , citationSuffix = []
            , citationMode = NormalCitation
            , citationNoteNum = 1
            , citationHash = 0
            }
        ]
        [ Str "[@legras_michel_2010]" ]
    ]
]

This is pandoc 2.19.2 on macOS 12.5.1.

@fiapps fiapps added the bug label Aug 28, 2022
@fiapps
Copy link
Author

fiapps commented Nov 10, 2022

II was bitten by this again, so here's another case. From the lack of comment, I gather that it is considered reasonable to expect users to escape the exclamation point. If this is what should be done, then pandoc's Markdown output is wrong, because it fails to escape the exclamation point, causing it to be incorrectly parsed by pandoc.

 % echo 'Not so\![ ]{.a}[i]{.b}' | pandoc -t markdown | pandoc -t native 
[ Para
    [ Str "Not"
    , Space
    , Str "so[]{.a}"
    , Span ( "" , [ "b" ] , [] ) [ Str "i" ]
    ]
]

The first pandoc invocation outputs Not so![]{.a}[i]{.b}: as in the case of a citation, the exclamation mark prevents the span from being recognized, and is not represented in the AST.

This is not exactly the same case as above, because it's a span that is parsed incorrectly rather than a citation, but I suspect it's the same issue with the Markdown parsing.

This is still pandoc 2.19.2, now on macOS 12.6.1.

jgm added a commit that referenced this issue Nov 11, 2022
@jgm
Copy link
Owner

jgm commented Aug 30, 2023

#9038 fixes the dropped !, at least.
The other issue (! preventing things from being parsed as links or citations) persists.

@jgm jgm closed this as completed in 7dca09d Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants