@@ -163,13 +163,23 @@ mathChars = concat <$>
163 <|> (\c -> ['\\',c]) <$> (try $ char '\\' *> anyChar)
163 <|> (\c -> ['\\',c]) <$> (try $ char '\\' *> anyChar)
166+quoted' :: (Inlines -> Inlines) -> LP String -> LP () -> LP Inlines
167+quoted' f starter ender = do
169+ try ((f . mconcat) <$> manyTill inline ender) <|> lit startchs
166double_quote :: LP Inlines
171double_quote :: LP Inlines
167−double_quote = (doubleQuoted . mconcat) <$>
172+double_quote =
168− (try $ string "``" *> manyTill inline (try $ string "''"))
173+ ( quoted' doubleQuoted (try $ string "``") (void $ try $ string "''")
174+ <|> quoted' doubleQuoted (string "“") (void $ char '”')
175+ <|> quoted' doubleQuoted (string "\"") (void $ char '"')
170single_quote :: LP Inlines
178single_quote :: LP Inlines
171−single_quote = (singleQuoted . mconcat) <$>
179+single_quote =
172− (try $ char '`' *> manyTill inline (try $ char '\'' >> notFollowedBy letter))
180+ ( quoted' singleQuoted (string "`") (try $ char '\'' >> notFollowedBy letter)
181+ <|> quoted' singleQuoted (string "‘") (try $ char '’' >> notFollowedBy letter)
174inline :: LP Inlines
184inline :: LP Inlines
175inline = (mempty <$ comment)
185inline = (mempty <$ comment)
@@ -181,10 +191,10 @@ inline = (mempty <$ comment)
181 ((char '-') *> option (str "–") (str "—" <$ char '-')))
191 ((char '-') *> option (str "–") (str "—" <$ char '-')))
182 <|> double_quote
192 <|> double_quote
183 <|> single_quote
193 <|> single_quote
184− <|> (str "“" <$ try (string "``")) -- nb. {``} won't be caught by double_quote
185 <|> (str "”" <$ try (string "''"))
194 <|> (str "”" <$ try (string "''"))
186− <|> (str "‘" <$ char '`') -- nb. {`} won't be caught by single_quote
195+ <|> (str "”" <$ char '”')
187 <|> (str "’" <$ char '\'')
196 <|> (str "’" <$ char '\'')
197+ <|> (str "’" <$ char '’')
188 <|> (str "\160" <$ char '~')
198 <|> (str "\160" <$ char '~')
189 <|> (mathDisplay $ string "$$" *> mathChars <* string "$$")
199 <|> (mathDisplay $ string "$$" *> mathChars <* string "$$")
190 <|> (mathInline $ char '$' *> mathChars <* char '$')
200 <|> (mathInline $ char '$' *> mathChars <* char '$')
@@ -755,7 +765,7 @@ inlineText :: LP Inlines
755inlineText = str <$> many1 inlineChar
765inlineText = str <$> many1 inlineChar
757inlineChar :: LP Char
767inlineChar :: LP Char
758−inlineChar = noneOf "\\$%^_&~#{}^'`-[] \t\n"
768+inlineChar = noneOf "\\$%^_&~#{}^'`\"‘’“”-[] \t\n"
760environment :: LP Blocks
770environment :: LP Blocks
761environment = do
771environment = do