git.iko.soy/typeable/pandoc
on master help sign in
Markdown: allow ---- in angle-bracket autolinks.

The uri parser is designed for bare URIs. In angle-bracket contexts, we can be sure that we don't have trailing punctuation. So `<http://openclipart.org/detail/22566/lego-smiley----happy-by-pitr>` should work now. Closes #768.

commit649608d3241eb2222502b9610a8c86fbfe282e9a authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 28 Feb 2013, 22:05 (14 years ago) parentabdaa96
1 file changed+7−2
src/Text/Pandoc/Readers/Markdown.hs+7−2
src/Text/Pandoc/Readers/Markdown.hs+7−2
@@ -41,6 +41,7 @@ import qualified Text.Pandoc.Builder as B
4141import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>))
4242import Text.Pandoc.Options
4343import Text.Pandoc.Shared
44+import Text.Pandoc.XML (fromEntities)
4445import Text.Pandoc.Parsing hiding (tableWith)
4546import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
4647import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
@@ -1565,8 +1566,12 @@ autoLink :: MarkdownParser (F Inlines)
15651566autoLink = try $ do
15661567 char '<'
15671568 (orig, src) <- uri <|> emailAddress
1568− char '>'
1569− return $ return $ B.link src "" (B.str orig)
1569+ -- in rare cases, something may remain after the uri parser
1570+ -- is finished, because the uri parser tries to avoid parsing
1571+ -- final punctuation. for example: in `<http://hi---there>`,
1572+ -- the URI parser will stop before the dashes.
1573+ extra <- fromEntities <$> manyTill nonspaceChar (char '>')
1574+ return $ return $ B.link (src ++ escapeURI extra) "" (B.str $ orig ++ extra)
15701575
15711576image :: MarkdownParser (F Inlines)
15721577image = try $ do