summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-28 02:43:04 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-28 02:43:04 +0000
commit465c0849ff6be236f5613ef091550399552cd505 (patch)
treec37ff9e045dd95419e0a2f1b0812c897c6bf7593 /src/Text/Pandoc/Writers
parent0928f650b1fb656bc160815fc12132b1b4997257 (diff)
Simplified HTML writer's treatment of autolinks.
There are now a few different cases for Link, and less conditional logic needed. git-svn-id: https://pandoc.googlecode.com/svn/trunk@813 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index afdfcf9e9..d61094975 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -142,7 +142,7 @@ obfuscateLink opts text src =
at' = obfuscateChar '@'
(linkText, altText) =
if "mailto:" `isPrefixOf` src' &&
- text' == ("<code>" ++ drop 7 src' ++ "</code>")
+ text' == drop 7 src'
then ("e", name ++ " at " ++ domain')
else ("'" ++ text' ++ "'",
text' ++ " (" ++ name ++ " at " ++
@@ -369,15 +369,15 @@ inlineToHtml opts inline =
else return ()
return $ stringToHtml str
(HtmlInline str) -> return $ primHtml str
+ (Link [Code str] (src,tit)) | src == "mailto:" ++ str ->
+ return $ obfuscateLink opts (stringToHtml str) src
+ (Link txt (src,tit)) | "mailto:" `isPrefixOf` src ->
+ do linkText <- inlineListToHtml opts txt
+ return $ obfuscateLink opts linkText src
(Link txt (src,tit)) ->
do linkText <- inlineListToHtml opts txt
- return $ if (isPrefixOf "mailto:" src)
- then obfuscateLink opts linkText src
- else anchor ! ([href src] ++
- if null tit
- then []
- else [title tit]) $
- linkText
+ return $ anchor ! ([href src] ++
+ if null tit then [] else [title tit]) $ linkText
(Image txt (source,tit)) ->
do alternate <- inlineListToHtml opts txt
let alternate' = renderHtmlFragment alternate