git.iko.soy/typeable/pandoc
on master help sign in
Fixed smart quote parsing in markdown reader so that unicode
ccb5fbbfiddlosopher
src/Text/Pandoc/Readers/Markdown.hs+10−6
@@ -59,7 +59,7 @@ hruleChars = "*-_"
59setextHChars = "=-"
59setextHChars = "=-"
60
60
61-- treat these as potentially non-text when parsing inline:
61-- treat these as potentially non-text when parsing inline:
62−specialChars = "\\[]*_~`<>$!^-.&'\""
62+specialChars = "\\[]*_~`<>$!^-.&'\"\8216\8217\8220\8221"
63
63
64--
64--
65-- auxiliary functions
65-- auxiliary functions
@@ -766,13 +766,17 @@ singleQuoteStart = do
766 satisfy (not . isAlphaNum))) -- possess/contraction
766 satisfy (not . isAlphaNum))) -- possess/contraction
767 return '\''
767 return '\''
768
768
769+singleQuoteEnd = char '\8217' <|>
769−singleQuoteEnd = (char '\'' <|> char '\8217') >> notFollowedBy alphaNum
770+ (char '\'' >> notFollowedBy alphaNum >> return '\'')
770
771
772+doubleQuoteStart = do
771−doubleQuoteStart = failIfInQuoteContext InDoubleQuote >>
773+ failIfInQuoteContext InDoubleQuote
774+ char '\8220' <|>
772− (char '"' <|> char '\8220') >>
775+ do char '"'
773− notFollowedBy (oneOf " \t\n")
776+ notFollowedBy (oneOf " \t\n")
777+ return '"'
774
778
775−doubleQuoteEnd = char '"' <|> char '\8221'
779+doubleQuoteEnd = char '\8221' <|> char '"'
776
780
777ellipses = oneOfStrings ["...", " . . . ", ". . .", " . . ."] >> return Ellipses
781ellipses = oneOfStrings ["...", " . . . ", ". . .", " . . ."] >> return Ellipses
778
782