git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: fixed smart quotes after emphasis.
b9a30efJohn MacFarlane
src/Text/Pandoc/Readers/Markdown.hs+6−5
@@ -1557,9 +1557,9 @@ ender c n = try $ do
1557three :: PandocMonad m => Char -> MarkdownParser m (F Inlines)
1557three :: PandocMonad m => Char -> MarkdownParser m (F Inlines)
1558three c = do
1558three c = do
1559 contents <- mconcat <$> many (notFollowedBy (ender c 1) >> inline)
1559 contents <- mconcat <$> many (notFollowedBy (ender c 1) >> inline)
1560− (ender c 3 >> return ((B.strong . B.emph) <$> contents))
1560+ (ender c 3 >> updateLastStrPos >> return ((B.strong . B.emph) <$> contents))
1561− <|> (ender c 2 >> one c (B.strong <$> contents))
1561+ <|> (ender c 2 >> updateLastStrPos >> one c (B.strong <$> contents))
1562− <|> (ender c 1 >> two c (B.emph <$> contents))
1562+ <|> (ender c 1 >> updateLastStrPos >> two c (B.emph <$> contents))
1563 <|> return (return (B.str [c,c,c]) <> contents)
1563 <|> return (return (B.str [c,c,c]) <> contents)
1564
1564
1565-- Parse inlines til you hit two c's, and emit strong.
1565-- Parse inlines til you hit two c's, and emit strong.
@@ -1567,7 +1567,8 @@ three c = do
1567two :: PandocMonad m => Char -> F Inlines -> MarkdownParser m (F Inlines)
1567two :: PandocMonad m => Char -> F Inlines -> MarkdownParser m (F Inlines)
1568two c prefix' = do
1568two c prefix' = do
1569 contents <- mconcat <$> many (try $ notFollowedBy (ender c 2) >> inline)
1569 contents <- mconcat <$> many (try $ notFollowedBy (ender c 2) >> inline)
1570+ (ender c 2 >> updateLastStrPos >>
1570− (ender c 2 >> return (B.strong <$> (prefix' <> contents)))
1571+ return (B.strong <$> (prefix' <> contents)))
1571 <|> return (return (B.str [c,c]) <> (prefix' <> contents))
1572 <|> return (return (B.str [c,c]) <> (prefix' <> contents))
1572
1573
1573-- Parse inlines til you hit a c, and emit emph.
1574-- Parse inlines til you hit a c, and emit emph.
@@ -1578,7 +1579,7 @@ one c prefix' = do
1578 <|> try (string [c,c] >>
1579 <|> try (string [c,c] >>
1579 notFollowedBy (ender c 1) >>
1580 notFollowedBy (ender c 1) >>
1580 two c mempty) )
1581 two c mempty) )
1581− (ender c 1 >> return (B.emph <$> (prefix' <> contents)))
1582+ (ender c 1 >> updateLastStrPos >> return (B.emph <$> (prefix' <> contents)))
1582 <|> return (return (B.str [c]) <> (prefix' <> contents))
1583 <|> return (return (B.str [c]) <> (prefix' <> contents))
1583
1584
1584strongOrEmph :: PandocMonad m => MarkdownParser m (F Inlines)
1585strongOrEmph :: PandocMonad m => MarkdownParser m (F Inlines)
test/command/2228.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc -f markdown+smart -t latex+smart
3+*foo*'s 'foo'
4+^D
5+\emph{foo}'s `foo'
6+```