diff options
author | Timm Albers <timmm.albers@gmail.com> | 2017-04-04 10:36:00 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-04-04 10:36:00 +0200 |
commit | f1eb3b316904a20ccde4b60aa62977ad73e2d6a2 (patch) | |
tree | 09a380f420d1a1d94bacde94a511fb914d7c79cd /src | |
parent | 7410d259c2ab11de0b01e37a6561eec0c9d69aaf (diff) | |
download | pandoc-f1eb3b316904a20ccde4b60aa62977ad73e2d6a2.tar.gz |
Add original classes to JS obfuscated links (#3554)
HTML links containing classes originally now preserve them when using
javascript email obfuscation.
Fixes #2989
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index ef5e6b416..d56a6e4ae 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -475,6 +475,8 @@ obfuscateLink opts attr (renderHtml -> txt) s = then ("e", name' ++ " at " ++ domain') else ("'" ++ obfuscateString txt ++ "'", txt ++ " (" ++ name' ++ " at " ++ domain' ++ ")") + (_, classNames, _) = attr + classNamesStr = concatMap (' ':) classNames in case meth of ReferenceObfuscation -> -- need to use preEscapedString or &'s are escaped to & in URL @@ -487,7 +489,8 @@ obfuscateLink opts attr (renderHtml -> txt) s = preEscapedString ("\n<!--\nh='" ++ obfuscateString domain ++ "';a='" ++ at' ++ "';n='" ++ obfuscateString name' ++ "';e=n+a+h;\n" ++ - "document.write('<a h'+'ref'+'=\"ma'+'ilto'+':'+e+'\" clas'+'s=\"em' + 'ail\">'+" ++ + "document.write('<a h'+'ref'+'=\"ma'+'ilto'+':'+e+'\" clas'+'s=\"em' + 'ail" ++ + classNamesStr ++ "\">'+" ++ linkText ++ "+'<\\/'+'a'+'>');\n// -->\n")) >> H.noscript (preEscapedString $ obfuscateString altText) _ -> throwError $ PandocSomeError $ "Unknown obfuscation method: " ++ show meth |