LaTeX reader: Use curly quotes for unmatched `.

Partially addresses #2555.

Note that there's still a problem with the code sample given.
This commit is contained in:
John MacFarlane 2015-11-23 23:44:39 -08:00
parent 2633dc2f5e
commit 2eb5d2dc42
2 changed files with 9 additions and 2 deletions

View file

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

View file

@ -302,7 +302,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
,Para [Str "4",Space,Str "<",Space,Str "5."]
,Para [Str "6",Space,Str ">",Space,Str "5."]
,Para [Str "Backslash:",Space,Str "\\"]
,Para [Str "Backtick:",Space,Str "`"]
,Para [Str "Backtick:",Space,Str "\8216"]
,Para [Str "Asterisk:",Space,Str "*"]
,Para [Str "Underscore:",Space,Str "_"]
,Para [Str "Left",Space,Str "brace:",Space,Str "{"]