summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RST.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-01-06 20:51:51 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-06 20:51:51 -0800
commit8c48bd8feb97e6c291df2e0ca09f62fb34711d33 (patch)
tree80821e64776ea6ed605f6134e53a2a93feda3e6c /src/Text/Pandoc/Writers/RST.hs
parent300f8528daaa13b6ee6931bbe8bb70eac914b333 (diff)
Don't put the text of an autolink in Code font.
Diffstat (limited to 'src/Text/Pandoc/Writers/RST.hs')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index a415c2de4..40939c6b7 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -348,8 +348,11 @@ inlineToRST (RawInline "rst" x) = return $ text x
inlineToRST (RawInline _ _) = return empty
inlineToRST (LineBreak) = return cr -- there's no line break in RST
inlineToRST Space = return space
-inlineToRST (Link [Code _ str] (src, _)) | src == str ||
- src == "mailto:" ++ str = do
+-- autolink
+inlineToRST (Link [Str str] (src, _))
+ | if "mailto:" `isPrefixOf` src
+ then src == escapeURI ("mailto:" ++ str)
+ else src == escapeURI str = do
let srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src
return $ text srcSuffix
inlineToRST (Link [Image alt (imgsrc,imgtit)] (src, _tit)) = do