git.iko.soy/typeable/pandoc
on master help sign in
Fix RST reference names with special characters
commit3b2c50ed93dfd00ea18974a856f25e0a423693dc authorLars-Dominik Braun <lars@6xq.net> dateMon 29 Jun 2015, 18:32 (11 years ago) parent27754e1
2 files changed+5−1
src/Text/Pandoc/Readers/RST.hs+1−1 tests/Tests/Readers/RST.hs+4
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -779,7 +779,7 @@ simpleReferenceName' :: Parser [Char] st String
779779simpleReferenceName' = do
780780 x <- alphaNum
781781 xs <- many $ alphaNum
782− <|> (try $ oneOf "-_:+." >> lookAhead alphaNum)
782+ <|> (try $ oneOf "-_:+." <* lookAhead alphaNum)
783783 return (x:xs)
784784
785785simpleReferenceName :: Parser [Char] st Inlines
tests/Tests/Readers/RST.hs+4
@@ -68,6 +68,10 @@ tests = [ "line block with blank line" =:
6868 link "http://foo.bar.baz" "" "http://foo.bar.baz" <> ". " <>
6969 link "http://foo.bar/baz_(bam)" "" "http://foo.bar/baz_(bam)"
7070 <> " (" <> link "http://foo.bar" "" "http://foo.bar" <> ")")
71+ , "Reference names with special characters" =:
72+ ("A-1-B_2_C:3:D+4+E.5.F_\n\n" ++
73+ ".. _A-1-B_2_C:3:D+4+E.5.F: https://example.com\n") =?>
74+ para (link "https://example.com" "" "A-1-B_2_C:3:D+4+E.5.F")
7175 , testGroup "literal / line / code blocks"
7276 [ "indented literal block" =: unlines
7377 [ "::"