From cfbf0f096bcdd9c9a5bfc2b394be863b39b34523 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 19 Sep 2022 10:30:29 -0700 Subject: [PATCH] Org reader: Allow org-ref v2 citations with `&` prefix. Closes #8302. --- src/Text/Pandoc/Readers/Org/Inlines.hs | 5 +++-- test/command/8302.md | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/command/8302.md diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs index 8b2b83185..b1da970b8 100644 --- a/src/Text/Pandoc/Readers/Org/Inlines.hs +++ b/src/Text/Pandoc/Readers/Org/Inlines.hs @@ -380,8 +380,9 @@ orgRefCiteKey = endOfCitation = try $ do many $ satisfy isCiteKeySpecialChar satisfy $ not . isCiteKeyChar - in try $ satisfy isCiteKeyChar `many1TillChar` lookAhead endOfCitation - + in try $ do + optional (char '&') -- this is used in org-ref v3 + satisfy isCiteKeyChar `many1TillChar` lookAhead endOfCitation -- | Supported citation types. Only a small subset of org-ref types is -- supported for now. TODO: rewrite this, use LaTeX reader as template. diff --git a/test/command/8302.md b/test/command/8302.md new file mode 100644 index 000000000..749530071 --- /dev/null +++ b/test/command/8302.md @@ -0,0 +1,6 @@ +``` +% pandoc -f org -t markdown +some text cite:&long-2004-tecton-evolut +^D +some text @long-2004-tecton-evolut +```