diff options
-rw-r--r-- | src/Tests/Readers/Markdown.hs | 9 | ||||
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs index c0eb672ca..941762bd0 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/src/Tests/Readers/Markdown.hs @@ -8,10 +8,14 @@ import Tests.Arbitrary() import Text.Pandoc.Builder -- import Text.Pandoc.Shared ( normalize ) import Text.Pandoc +import Data.Sequence (singleton) markdown :: String -> Pandoc markdown = readMarkdown defaultParserState{ stateStandalone = True } +markdownSmart :: String -> Pandoc +markdownSmart = readMarkdown defaultParserState{ stateSmart = True } + infix 5 =: (=:) :: ToString c => String -> (String, c) -> Test @@ -40,6 +44,11 @@ tests = [ testGroup "inline code" "`*` {.haskell .special x=\"7\"}" =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*") ] + , testGroup "smart punctuation" + [ test markdownSmart "quote before ellipses" + ("'...hi'" + =?> para (singleQuoted (singleton Ellipses +++ "hi"))) + ] , testGroup "mixed emphasis and strong" [ "emph and strong emph alternating" =: "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx" diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index c16d99bdf..700076a10 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -759,7 +759,8 @@ singleQuoteStart :: GenParser Char ParserState () singleQuoteStart = do failIfInQuoteContext InSingleQuote try $ do charOrRef "'\8216\145" - notFollowedBy (oneOf ")!],.;:-? \t\n") + notFollowedBy (oneOf ")!],;:-? \t\n") + notFollowedBy (char '.') <|> lookAhead (string "..." >> return ()) notFollowedBy (try (oneOfStrings ["s","t","m","ve","ll","re"] >> satisfy (not . isAlphaNum))) -- possess/contraction |