diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-11-15 17:29:24 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-11-15 17:29:24 +0000 |
commit | 87d6d0d069fc24724ee55cf54711c8abe2f2d072 (patch) | |
tree | 0e5a9ddd6d1cbba9365e97a8ebee297ee1d2bfc9 | |
parent | ccb5fbb20915a043c83c6a0cacedc8f6e58be7e4 (diff) |
Fixed logic in markdown smart quote parsing:
+ Added some needed 'try' statements.
+ Unicode right single-quote can double as apostrophe, so treat it
as a quote-end only when not followed by an alphanumeric character.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1077 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 080e2525c..e50180a63 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -760,21 +760,24 @@ failIfInQuoteContext context = do singleQuoteStart = do failIfInQuoteContext InSingleQuote char '\8216' <|> - do char '\'' - notFollowedBy (oneOf ")!],.;:-? \t\n") - notFollowedBy (try (oneOfStrings ["s","t","m","ve","ll","re"] >> - satisfy (not . isAlphaNum))) -- possess/contraction - return '\'' - -singleQuoteEnd = char '\8217' <|> - (char '\'' >> notFollowedBy alphaNum >> return '\'') + (try $ do char '\'' + notFollowedBy (oneOf ")!],.;:-? \t\n") + notFollowedBy (try (oneOfStrings ["s","t","m","ve","ll","re"] >> + satisfy (not . isAlphaNum))) + -- possess/contraction + return '\'') + +singleQuoteEnd = try $ do + char '\8217' <|> char '\'' + notFollowedBy alphaNum + return '\'' doubleQuoteStart = do failIfInQuoteContext InDoubleQuote char '\8220' <|> - do char '"' - notFollowedBy (oneOf " \t\n") - return '"' + (try $ do char '"' + notFollowedBy (oneOf " \t\n") + return '"') doubleQuoteEnd = char '\8221' <|> char '"' |