diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-24 20:55:27 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-01-24 20:55:27 +0000 |
commit | 11456ba5ce250854e4912bb50cddd113a07728a7 (patch) | |
tree | ca70a530f36ce584682fa4ad2654357424273644 | |
parent | c94dacec353069939d14f022197e36f030c68bd9 (diff) | |
download | pandoc-11456ba5ce250854e4912bb50cddd113a07728a7.tar.gz |
Changed Markdown autoLink parsing to conform better to
Markdown.pl's behavior. <google.com> is not treated as
a link, but <http://google.com>, <ftp://google.com>, and
<mailto:google@google.com> are.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@513 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 5354574b9..3aa0a6f12 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -928,9 +928,7 @@ referenceLinkSingle = try (do else fail "no corresponding key" return (Link label (Ref label))) -autoLink = do - notFollowedBy' (anyHtmlTag <|> anyHtmlEndTag) - autoLinkEmail <|> autoLinkRegular +autoLink = autoLinkEmail <|> autoLinkRegular -- a link <like@this.com> autoLinkEmail = try $ do @@ -941,10 +939,12 @@ autoLinkEmail = try $ do char autoLinkEnd return $ Link [Str src] (Src ("mailto:" ++ src) "") --- a link <like.this.com> +-- a link <http://like.this.com> autoLinkRegular = try $ do - src <- between (char autoLinkStart) (char autoLinkEnd) - (many (noneOf (spaceChars ++ endLineChars ++ [autoLinkEnd]))) + char autoLinkStart + prot <- oneOfStrings ["http:", "ftp:", "mailto:"] + rest <- many1Till (noneOf " \t\n<>") (char autoLinkEnd) + let src = prot ++ rest return $ Link [Str src] (Src src "") image = try (do |