aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-27 22:45:14 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-27 22:45:14 +0000
commit8e0ad5a006bf0402f37c7d884bb48c39689c6246 (patch)
tree13317709e8669536d23a95bdd63271a887ce69cb /src/Text/Pandoc
parent141affdb5140478464bf3c7331f6be4cf9454dd6 (diff)
downloadpandoc-8e0ad5a006bf0402f37c7d884bb48c39689c6246.tar.gz
Cleaned up handling of embedded quotes in link titles.
Now these are stored as a '"' character, not as '&quot;'. The function escapeLinkTitle in the Markdown writer is unnecessary and was removed. Tests modified accordingly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@517 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs3
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs10
2 files changed, 4 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 9b3f047e9..0f1ef348d 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -894,8 +894,7 @@ titleWith startChar endChar = try (do
char endChar
skipSpaces
notFollowedBy (noneOf ")\n")))
- let tit' = substitute "\"" "&quot;" tit
- return tit')
+ return tit)
title = choice [ titleWith '(' ')',
titleWith '"' '"',
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 46c47bf74..4d3f844b5 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -52,10 +52,6 @@ writeMarkdown options (Pandoc meta blocks) =
escapeString :: String -> String
escapeString = backslashEscape "`<\\*_^"
--- | Escape embedded \" in link title.
-escapeLinkTitle :: String -> String
-escapeLinkTitle = substitute "\"" "\\\""
-
-- | Take list of inline elements and return wrapped doc.
wrappedMarkdown :: [Inline] -> Doc
wrappedMarkdown lst =
@@ -119,7 +115,7 @@ blockToMarkdown tabStop (Note ref lst) =
blockToMarkdown tabStop (Key txt (Src src tit)) =
text " " <> char '[' <> inlineListToMarkdown txt <> char ']' <>
text ": " <> text src <>
- if tit /= "" then text (" \"" ++ (escapeLinkTitle tit) ++ "\"") else empty
+ if tit /= "" then text (" \"" ++ tit ++ "\"") else empty
blockToMarkdown tabStop (CodeBlock str) =
(nest tabStop $ vcat $ map text (lines str)) <> text "\n"
blockToMarkdown tabStop (RawHtml str) = text str
@@ -185,7 +181,7 @@ inlineToMarkdown (Link txt (Src src tit)) =
else inlineListToMarkdown txt
linktitle = if null tit
then empty
- else text (" \"" ++ (escapeLinkTitle tit) ++ "\"")
+ else text (" \"" ++ tit ++ "\"")
srcSuffix = if isPrefixOf "mailto:" src then drop 7 src else src in
if (null tit) && (txt == [Str srcSuffix])
then char '<' <> text srcSuffix <> char '>'
@@ -203,7 +199,7 @@ inlineToMarkdown (Image alternate (Src source tit)) =
else inlineListToMarkdown alternate in
char '!' <> char '[' <> alt <> char ']' <> char '(' <> text source <>
(if tit /= ""
- then text (" \"" ++ (escapeLinkTitle tit) ++ "\"")
+ then text (" \"" ++ tit ++ "\"")
else empty) <> char ')'
inlineToMarkdown (Image alternate (Ref ref)) =
char '!' <> inlineToMarkdown (Link alternate (Ref ref))