diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-02-15 22:39:49 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-02-15 22:39:49 -0800 |
commit | 59764fa3884e63ee9711cc2d0da2ef3133c641ba (patch) | |
tree | 37ccf85baf7dbebb5241b7da6d35f565f8d5af95 /src | |
parent | 5491adbfdb0a1c75d2008ad40da7136dffeeb161 (diff) | |
download | pandoc-59764fa3884e63ee9711cc2d0da2ef3133c641ba.tar.gz |
Parsing: uri, email: resolve entities.
A markdown link `<http://göogle.com>` should
be a link to http://göogle.com.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index ebff8ec77..062e66eff 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -149,6 +149,7 @@ where import Text.Pandoc.Definition import Text.Pandoc.Options import Text.Pandoc.Builder (Blocks, Inlines, rawBlock) +import Text.Pandoc.XML (fromEntities) import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn) import Text.Parsec import Text.Parsec.Pos (newPos) @@ -369,7 +370,7 @@ romanNumeral upperCase = do -- escaped mailto: URI. emailAddress :: Parser [Char] st (String, String) emailAddress = try $ liftA2 toResult mailbox (char '@' *> domain) - where toResult mbox dom = let full = mbox ++ '@':dom + where toResult mbox dom = let full = fromEntities $ mbox ++ '@':dom in (full, escapeURI $ "mailto:" ++ full) mailbox = intercalate "." `fmap` (emailWord `sepby1` dot) domain = intercalate "." `fmap` (subdomain `sepby1` dot) @@ -440,7 +441,7 @@ uri = try $ do <|> enclosed (char '[') (char ']') uriChunk) <|> uriChunk)) str' <- option str $ char '/' >> return (str ++ "/") - let uri' = scheme ++ ":" ++ str' + let uri' = scheme ++ ":" ++ fromEntities str' return (uri', escapeURI uri') -- | Applies a parser, returns tuple of its results and its horizontal |