aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-09-13 22:57:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-09-13 22:57:08 -0700
commita3162d341b2937113514b5f515cbc86141fbfcf2 (patch)
tree47f9962bb1464c1d0d1a2006a79726ca3915cd6d
parentb34dc28926c11701f61e91e6f64244b438e8f701 (diff)
downloadpandoc-a3162d341b2937113514b5f515cbc86141fbfcf2.tar.gz
RST reader: handle escaped colons in reference definitions.
Cloess #7568.
-rw-r--r--src/Text/Pandoc/Readers/RST.hs3
-rw-r--r--test/command/7568.md11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index ff891d3c6..458a2d48b 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -1155,10 +1155,11 @@ referenceNames = do
let rn = try $ do
string ".. _"
ref <- quotedReferenceName
- <|> manyChar ( noneOf ":\n"
+ <|> manyChar ( noneOf "\\:\n"
<|> try (char '\n' <*
string " " <*
notFollowedBy blankline)
+ <|> try (char '\\' *> char ':')
<|> try (char ':' <* lookAhead alphaNum)
)
char ':'
diff --git a/test/command/7568.md b/test/command/7568.md
new file mode 100644
index 000000000..42f1e37b1
--- /dev/null
+++ b/test/command/7568.md
@@ -0,0 +1,11 @@
+```
+% pandoc -f rst
+While `Labyrinth Lord: Revised Edition`_ (LLRE; PDF and POD) has been
+criticized for not being a completely faithful retro-clone of the
+Moldvay/Cook/Marsh Basic/Expert D&D rules (B/X), I think it still
+holds a useful spot.
+
+.. _Labyrinth Lord\: Revised Edition: https://www.drivethrurpg.com/product/64332/Labyrinth-Lord-Revised-Edition
+^D
+<p>While <a href="https://www.drivethrurpg.com/product/64332/Labyrinth-Lord-Revised-Edition">Labyrinth Lord: Revised Edition</a> (LLRE; PDF and POD) has been criticized for not being a completely faithful retro-clone of the Moldvay/Cook/Marsh Basic/Expert D&amp;D rules (B/X), I think it still holds a useful spot.</p>
+```