From 2eb5d2dc421245fa0a66ddb2f0599a076228413b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 23 Nov 2015 23:44:39 -0800 Subject: LaTeX reader: Use curly quotes for unmatched `. Partially addresses #2555. Note that there's still a problem with the code sample given. --- src/Text/Pandoc/Readers/LaTeX.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 673deba14..241ac145a 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -166,8 +166,15 @@ mathChars = (concat <$>) $ quoted' :: (Inlines -> Inlines) -> LP String -> LP () -> LP Inlines quoted' f starter ender = do + smart <- getOption readerSmart startchs <- starter - try ((f . mconcat) <$> manyTill inline ender) <|> lit startchs + ((f . mconcat) <$> manyTill inline ender) <|> + lit (if smart + then case startchs of + "``" -> "“" + "`" -> "‘" + _ -> startchs + else startchs) doubleQuote :: LP Inlines doubleQuote = do -- cgit v1.2.3