From ccb5fbb20915a043c83c6a0cacedc8f6e58be7e4 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Thu, 15 Nov 2007 03:55:58 +0000 Subject: Fixed smart quote parsing in markdown reader so that unicode characters 8216 and 8217 are recognized as single quotes, and 8220 and 8221 as double quotes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1075 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index df84c0ac7..080e2525c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -59,7 +59,7 @@ hruleChars = "*-_" setextHChars = "=-" -- treat these as potentially non-text when parsing inline: -specialChars = "\\[]*_~`<>$!^-.&'\"" +specialChars = "\\[]*_~`<>$!^-.&'\"\8216\8217\8220\8221" -- -- auxiliary functions @@ -766,13 +766,17 @@ singleQuoteStart = do satisfy (not . isAlphaNum))) -- possess/contraction return '\'' -singleQuoteEnd = (char '\'' <|> char '\8217') >> notFollowedBy alphaNum +singleQuoteEnd = char '\8217' <|> + (char '\'' >> notFollowedBy alphaNum >> return '\'') -doubleQuoteStart = failIfInQuoteContext InDoubleQuote >> - (char '"' <|> char '\8220') >> - notFollowedBy (oneOf " \t\n") +doubleQuoteStart = do + failIfInQuoteContext InDoubleQuote + char '\8220' <|> + do char '"' + notFollowedBy (oneOf " \t\n") + return '"' -doubleQuoteEnd = char '"' <|> char '\8221' +doubleQuoteEnd = char '\8221' <|> char '"' ellipses = oneOfStrings ["...", " . . . ", ". . .", " . . ."] >> return Ellipses -- cgit v1.2.3