diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 10 |
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 "\"" """ 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)) |