git.iko.soy/typeable/pandoc
on master help sign in
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

commitccb5fbb20915a043c83c6a0cacedc8f6e58be7e4 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 15 Nov 2007, 03:55 (19 years ago) parent506bf38
1 file changed+10−6
src/Text/Pandoc/Readers/Markdown.hs+10−6
src/Text/Pandoc/Readers/Markdown.hs+10−6
@@ -59,7 +59,7 @@ hruleChars = "*-_"
5959setextHChars = "=-"
6060
6161-- treat these as potentially non-text when parsing inline:
62−specialChars = "\\[]*_~`<>$!^-.&'\""
62+specialChars = "\\[]*_~`<>$!^-.&'\"\8216\8217\8220\8221"
6363
6464--
6565-- auxiliary functions
@@ -766,13 +766,17 @@ singleQuoteStart = do
766766 satisfy (not . isAlphaNum))) -- possess/contraction
767767 return '\''
768768
769−singleQuoteEnd = (char '\'' <|> char '\8217') >> notFollowedBy alphaNum
769+singleQuoteEnd = char '\8217' <|>
770+ (char '\'' >> notFollowedBy alphaNum >> return '\'')
770771
771−doubleQuoteStart = failIfInQuoteContext InDoubleQuote >>
772− (char '"' <|> char '\8220') >>
773− notFollowedBy (oneOf " \t\n")
772+doubleQuoteStart = do
773+ failIfInQuoteContext InDoubleQuote
774+ char '\8220' <|>
775+ do char '"'
776+ notFollowedBy (oneOf " \t\n")
777+ return '"'
774778
775−doubleQuoteEnd = char '"' <|> char '\8221'
779+doubleQuoteEnd = char '\8221' <|> char '"'
776780
777781ellipses = oneOfStrings ["...", " . . . ", ". . .", " . . ."] >> return Ellipses
778782