git.iko.soy/typeable/pandoc
on master help sign in
HTML Writer: Don't double render when email-obfuscation=none

Closes #1625

commit1f0ba8ec11763d6f6335e0355402c5f4570850e8 authormpickering <matthewtpickering@gmail.com> dateThu 25 Sep 2014, 18:46 (12 years ago) parent85cff71
1 file changed+5−5
src/Text/Pandoc/Writers/HTML.hs+5−5
src/Text/Pandoc/Writers/HTML.hs+5−5
@@ -1,4 +1,4 @@
1−{-# LANGUAGE OverloadedStrings, CPP #-}
1+{-# LANGUAGE OverloadedStrings, CPP, ViewPatterns #-}
22{-# OPTIONS_GHC -fno-warn-deprecations #-}
33{-
44Copyright (C) 2006-2014 John MacFarlane <jgm@berkeley.edu>
@@ -348,10 +348,10 @@ parseMailto s = do
348348 _ -> fail "not a mailto: URL"
349349
350350-- | Obfuscate a "mailto:" link.
351−obfuscateLink :: WriterOptions -> String -> String -> Html
351+obfuscateLink :: WriterOptions -> Html -> String -> Html
352352obfuscateLink opts txt s | writerEmailObfuscation opts == NoObfuscation =
353− H.a ! A.href (toValue s) $ toHtml txt
354−obfuscateLink opts txt s =
353+ H.a ! A.href (toValue s) $ txt
354+obfuscateLink opts (renderHtml -> txt) s =
355355 let meth = writerEmailObfuscation opts
356356 s' = map toLower (take 7 s) ++ drop 7 s
357357 in case parseMailto s' of
@@ -753,7 +753,7 @@ inlineToHtml opts inline =
753753 | otherwise -> return mempty
754754 (Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
755755 linkText <- inlineListToHtml opts txt
756− return $ obfuscateLink opts (renderHtml linkText) s
756+ return $ obfuscateLink opts linkText s
757757 (Link txt (s,tit)) -> do
758758 linkText <- inlineListToHtml opts txt
759759 let s' = case s of