aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs14
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs2
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index ad3b015b4..3f4c76be4 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -972,7 +972,7 @@ autoLinkEmail = try $ do
domain <- sepBy1 (many1 (noneOf "/:.@<> \t\n")) (char '.')
let src = name ++ "@" ++ (joinWithSep "." domain)
char '>'
- return $ Link [Str src] (("mailto:" ++ src), "")
+ return $ Link [Code src] (("mailto:" ++ src), "")
-- a link <http://like.this.com>
autoLinkRegular = try $ do
@@ -980,7 +980,7 @@ autoLinkRegular = try $ do
prot <- oneOfStrings ["http:", "ftp:", "mailto:"]
rest <- many1Till (noneOf " \t\n<>") (char '>')
let src = prot ++ rest
- return $ Link [Str src] (src, "")
+ return $ Link [Code src] (src, "")
image = try (do
char '!'
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index c860d73e6..afdfcf9e9 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -140,13 +140,13 @@ obfuscateLink opts text src =
(Just [name, domain]) ->
let domain' = substitute "." " dot " domain
at' = obfuscateChar '@'
- linkText = if src' == ("mailto:" ++ text')
- then "e"
- else "'" ++ text' ++ "'"
- altText = if src' == ("mailto:" ++ text')
- then name ++ " at " ++ domain'
- else text' ++ " (" ++ name ++ " at " ++
- domain' ++ ")" in
+ (linkText, altText) =
+ if "mailto:" `isPrefixOf` src' &&
+ text' == ("<code>" ++ drop 7 src' ++ "</code>")
+ then ("e", name ++ " at " ++ domain')
+ else ("'" ++ text' ++ "'",
+ text' ++ " (" ++ name ++ " at " ++
+ domain' ++ ")") in
if writerStrictMarkdown opts
then -- need to use primHtml or &'s are escaped to &amp; in URL
primHtml $ "<a href=\"" ++ (obfuscateString src')
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 2d74b9ffa..739b60133 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -247,7 +247,7 @@ inlineToLaTeX (HtmlInline str) = return ""
inlineToLaTeX (LineBreak) = return "\\\\\n"
inlineToLaTeX Space = return " "
inlineToLaTeX (Link text (src, tit)) = do
- contents <- inlineListToLaTeX (deVerb text)
+ contents <- inlineListToLaTeX text
addToHeader "\\usepackage[breaklinks=true]{hyperref}"
return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}"
inlineToLaTeX (Image alternate (source, tit)) = do
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 4008d50e3..c6c3f3156 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -318,7 +318,7 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
let linktitle = if null tit then empty else text $ " \"" ++ tit ++ "\""
let srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src
let useRefLinks = writerReferenceLinks opts
- let useAuto = null tit && txt == [Str srcSuffix]
+ let useAuto = null tit && txt == [Code srcSuffix]
ref <- if useRefLinks then getReference txt (src, tit) else return []
reftext <- inlineListToMarkdown opts ref
return $ if useAuto