aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-03-12 19:18:14 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-03-12 19:18:14 -0700
commitd820eb2c47bccfd81a51503e997596addb584198 (patch)
treed8d5126f3ffaf4531e11d9b71906ac91a0c01c62 /src/Text
parent54782c2af68c1b80d69ee028e74dd5ed17c0a934 (diff)
downloadpandoc-d820eb2c47bccfd81a51503e997596addb584198.tar.gz
Markdown reader: Handle unmatched double quotes in dialogues.
They do not generate a Quoted element; instead, the double quote is just turned into a Str with a curly left quote. This should satisfy the fiction writers. Closes #99 (again).
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 50ee1aef3..591fcf155 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1748,9 +1748,14 @@ singleQuoted = try $ do
fmap B.singleQuoted . trimInlinesF . mconcat <$>
many1Till inline singleQuoteEnd
+-- doubleQuoted will handle regular double-quoted sections, as well
+-- as dialogues with an open double-quote without a close double-quote
+-- in the same paragraph.
doubleQuoted :: MarkdownParser (F Inlines)
doubleQuoted = try $ do
doubleQuoteStart
- withQuoteContext InDoubleQuote $
- fmap B.doubleQuoted . trimInlinesF . mconcat <$>
- many1Till inline doubleQuoteEnd
+ contents <- mconcat <$> many (try $ notFollowedBy doubleQuoteEnd >> inline)
+ (withQuoteContext InDoubleQuote $ doubleQuoteEnd >> return
+ (fmap B.doubleQuoted . trimInlinesF $ contents))
+ <|> (return $ return (B.str "\8220") <> contents)
+