aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-11-15 03:55:58 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-11-15 03:55:58 +0000
commitccb5fbb20915a043c83c6a0cacedc8f6e58be7e4 (patch)
treedfea51dc68d0d85736bb37217183971fe084a99c /src/Text/Pandoc
parent506bf38bcb316be31e1dcb3af8c702a8741fd1a5 (diff)
downloadpandoc-ccb5fbb20915a043c83c6a0cacedc8f6e58be7e4.tar.gz
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
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs16
1 files changed, 10 insertions, 6 deletions
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