summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-02-24 09:55:25 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2023-02-24 09:55:25 -0800
commitb81ead43e03f702c78e9ed4749acfa85188468d7 (patch)
tree23cff5963df7c548dfa149862697514c9a2f935a /src/Text
parentda66390f8378642e0ee146c0b73ce7c1088d565a (diff)
RST reader: align with spec in syntax for role names.
In particular, we now allow colons in row names. Closes #8653.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 560e35f40..dcaddaa60 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -1480,8 +1480,11 @@ renderRole contents fmt role attr = case role of
removeSpace (x:xs) = x : map headSpace xs
removeSpace [] = []
+-- single words consisting of alphanumerics plus isolated (no two adjacent)
+-- internal hyphens, underscores, periods, colons and plus signs;
+-- no whitespace or other characters are allowed
roleName :: PandocMonad m => RSTParser m Text
-roleName = many1Char (letter <|> char '-')
+roleName = many1Char (alphaNum <|> try (oneOf "-_.:+" <* lookAhead alphaNum))
roleMarker :: PandocMonad m => RSTParser m Text
roleMarker = char ':' *> roleName <* char ':'