git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: fixed smart quotes after emphasis.

E.g. in *foo*'s 'foo' Closes #2228.

commitb9a30ef9596b8d19554e03cd1ef8f0dc0695a486 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 24 May 2017, 23:23 (9 years ago) parent8f718b0
2 files changed+12−5
src/Text/Pandoc/Readers/Markdown.hs+6−5 test/command/2228.md+6
src/Text/Pandoc/Readers/Markdown.hs+6−5
@@ -1557,9 +1557,9 @@ ender c n = try $ do
15571557three :: PandocMonad m => Char -> MarkdownParser m (F Inlines)
15581558three c = do
15591559 contents <- mconcat <$> many (notFollowedBy (ender c 1) >> inline)
1560− (ender c 3 >> return ((B.strong . B.emph) <$> contents))
1561− <|> (ender c 2 >> one c (B.strong <$> contents))
1562− <|> (ender c 1 >> two c (B.emph <$> contents))
1560+ (ender c 3 >> updateLastStrPos >> return ((B.strong . B.emph) <$> contents))
1561+ <|> (ender c 2 >> updateLastStrPos >> one c (B.strong <$> contents))
1562+ <|> (ender c 1 >> updateLastStrPos >> two c (B.emph <$> contents))
15631563 <|> return (return (B.str [c,c,c]) <> contents)
15641564
15651565-- Parse inlines til you hit two c's, and emit strong.
@@ -1567,7 +1567,8 @@ three c = do
15671567two :: PandocMonad m => Char -> F Inlines -> MarkdownParser m (F Inlines)
15681568two c prefix' = do
15691569 contents <- mconcat <$> many (try $ notFollowedBy (ender c 2) >> inline)
1570− (ender c 2 >> return (B.strong <$> (prefix' <> contents)))
1570+ (ender c 2 >> updateLastStrPos >>
1571+ return (B.strong <$> (prefix' <> contents)))
15711572 <|> return (return (B.str [c,c]) <> (prefix' <> contents))
15721573
15731574-- Parse inlines til you hit a c, and emit emph.
@@ -1578,7 +1579,7 @@ one c prefix' = do
15781579 <|> try (string [c,c] >>
15791580 notFollowedBy (ender c 1) >>
15801581 two c mempty) )
1581− (ender c 1 >> return (B.emph <$> (prefix' <> contents)))
1582+ (ender c 1 >> updateLastStrPos >> return (B.emph <$> (prefix' <> contents)))
15821583 <|> return (return (B.str [c]) <> (prefix' <> contents))
15831584
15841585strongOrEmph :: 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+```