diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-06-29 18:32:46 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-06-29 18:34:45 +0200 |
commit | 3b2c50ed93dfd00ea18974a856f25e0a423693dc (patch) | |
tree | 29dbfb6b81e8556d377dab6208e2749171201917 | |
parent | 27754e170b951c07ac8a395b316f3a5baedee2f3 (diff) | |
download | pandoc-3b2c50ed93dfd00ea18974a856f25e0a423693dc.tar.gz |
Fix RST reference names with special characters
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 2 | ||||
-rw-r--r-- | tests/Tests/Readers/RST.hs | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 4b05b2799..38de77f9f 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -779,7 +779,7 @@ simpleReferenceName' :: Parser [Char] st String simpleReferenceName' = do x <- alphaNum xs <- many $ alphaNum - <|> (try $ oneOf "-_:+." >> lookAhead alphaNum) + <|> (try $ oneOf "-_:+." <* lookAhead alphaNum) return (x:xs) simpleReferenceName :: Parser [Char] st Inlines diff --git a/tests/Tests/Readers/RST.hs b/tests/Tests/Readers/RST.hs index 5eabec89a..7f1f3d044 100644 --- a/tests/Tests/Readers/RST.hs +++ b/tests/Tests/Readers/RST.hs @@ -68,6 +68,10 @@ tests = [ "line block with blank line" =: link "http://foo.bar.baz" "" "http://foo.bar.baz" <> ". " <> link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)" <> " (" <> link "http://foo.bar" "" "http://foo.bar" <> ")") + , "Reference names with special characters" =: + ("A-1-B_2_C:3:D+4+E.5.F_\n\n" ++ + ".. _A-1-B_2_C:3:D+4+E.5.F: https://example.com\n") =?> + para (link "https://example.com" "" "A-1-B_2_C:3:D+4+E.5.F") , testGroup "literal / line / code blocks" [ "indented literal block" =: unlines [ "::" |