Fixe autolinks with following punctuation.
Closes #1811.
The price of this is that autolinked bare URIs can no longer
contain `>` characters, but this is not a big issue.
commit2b08e32a9090442b530822f151c94fbd7d1cbbd1
authorJohn MacFarlane <jgm@berkeley.edu>
dateSun 14 Dec 2014, 12:20 (12 years ago)
parent4ffa709
src/Text/Pandoc/Parsing.hs+1−1
@@ -452,7 +452,7 @@ uri = try $ do
452452 let percentEscaped = try $ char '%' >> skipMany1 (satisfy isHexDigit)
453453 let entity = () <$ characterReference
454454 let punct = skipMany1 (char ',')
455− <|> () <$ (satisfy (\c -> not (isSpace c) && c /= '<'))
455+ <|> () <$ (satisfy (\c -> not (isSpace c) && c /= '<' && c /= '>'))
456456 let uriChunk = skipMany1 wordChar
457457 <|> percentEscaped
458458 <|> entity
tests/Tests/Readers/Markdown.hs+5
@@ -187,6 +187,11 @@ tests = [ testGroup "inline code"
187187 ]
188188 , testGroup "bare URIs"
189189 (map testBareLink bareLinkTests)
190+ , testGroup "autolinks"
191+ [ "with unicode dash following" =:
192+ "<http://foo.bar>\8212" =?> para (autolink "http://foo.bar" <>
193+ str "\8212")
194+ ]
190195 , testGroup "Headers"
191196 [ "blank line before header" =:
192197 "\n# Header\n"