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:
parent
54782c2af6
commit
d820eb2c47
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue