diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-28 02:43:04 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-07-28 02:43:04 +0000 |
commit | 465c0849ff6be236f5613ef091550399552cd505 (patch) | |
tree | c37ff9e045dd95419e0a2f1b0812c897c6bf7593 | |
parent | 0928f650b1fb656bc160815fc12132b1b4997257 (diff) | |
download | pandoc-465c0849ff6be236f5613ef091550399552cd505.tar.gz |
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
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 16 |
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 |