From 465c0849ff6be236f5613ef091550399552cd505 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 28 Jul 2007 02:43:04 +0000 Subject: 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 --- src/Text/Pandoc/Writers/HTML.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') 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' == ("" ++ drop 7 src' ++ "") + 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 -- cgit v1.2.3