git.iko.soy/typeable/pandoc
on master help sign in
Fixed bug with intraword emphasis.

Closes #1066.

commitcf149fcf38d98b1bee79ecd9056fa0f46264e7ce authorJohn MacFarlane <jgm@berkeley.edu> dateFri 22 Nov 2013, 19:41 (13 years ago) parent3d453f0
2 files changed+7−1
src/Text/Pandoc/Readers/Markdown.hs+2−1 tests/Tests/Readers/Markdown.hs+5
src/Text/Pandoc/Readers/Markdown.hs+2−1
@@ -1455,6 +1455,7 @@ enclosure c = do
14551455-- Parse inlines til you hit one c or a sequence of two cs.
14561456-- If one c, emit emph and then parse two.
14571457-- If two cs, emit strong and then parse one.
1458+-- Otherwise, emit ccc then the results.
14581459three :: Char -> MarkdownParser (F Inlines)
14591460three c = do
14601461 contents <- mconcat <$> many (notFollowedBy (char c) >> inline)
@@ -1479,7 +1480,7 @@ one c prefix' = do
14791480 contents <- mconcat <$> many ( (notFollowedBy (char c) >> inline)
14801481 <|> try (string [c,c] >>
14811482 notFollowedBy (char c) >>
1482− two c prefix') )
1483+ two c mempty) )
14831484 (char c >> return (B.emph <$> (prefix' <> contents)))
14841485 <|> return (return (B.str [c]) <> (prefix' <> contents))
14851486
tests/Tests/Readers/Markdown.hs+5
@@ -136,6 +136,11 @@ tests = [ testGroup "inline code"
136136 "`*` {.haskell .special x=\"7\"}"
137137 =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
138138 ]
139+ , testGroup "emph and strong"
140+ [ "two strongs in emph" =:
141+ "***a**b **c**d*" =?> para (emph (strong (str "a") <> str "b" <> space
142+ <> strong (str "c") <> str "d"))
143+ ]
139144 , testGroup "raw LaTeX"
140145 [ "in URL" =:
141146 "\\begin\n" =?> para (text "\\begin")