Skip to content

Commit

Permalink
Markdown reader: Handle unmatched double quotes in dialogues.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
John MacFarlane committed Mar 13, 2013
1 parent 54782c2 commit d820eb2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Text/Pandoc/Readers/Markdown.hs
Expand Up @@ -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)

0 comments on commit d820eb2

Please sign in to comment.