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).
This commit is contained in:
John MacFarlane 2013-03-12 19:18:14 -07:00
parent 54782c2af6
commit d820eb2c47

View file

@ -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)