Muse writer: use lightweight markup after </em> tag

This commit is contained in:
Alexander Krotov 2018-10-21 20:19:29 +03:00
parent 3ec0b78343
commit a98e2b7c42
2 changed files with 4 additions and 0 deletions

View file

@ -548,6 +548,7 @@ inlineToMuse (Emph lst) = do
let lst' = normalizeInlineList lst let lst' = normalizeInlineList lst
if useTags || null lst' || startsWithSpace lst' || endsWithSpace lst' if useTags || null lst' || startsWithSpace lst' || endsWithSpace lst'
then do contents <- inlineListToMuse lst' then do contents <- inlineListToMuse lst'
modify $ \st -> st { stUseTags = False }
return $ "<em>" <> contents <> "</em>" return $ "<em>" <> contents <> "</em>"
else do contents <- local (\env -> env { envInsideAsterisks = True }) $ inlineListToMuse lst' else do contents <- local (\env -> env { envInsideAsterisks = True }) $ inlineListToMuse lst'
modify $ \st -> st { stUseTags = True } modify $ \st -> st { stUseTags = True }

View file

@ -400,6 +400,9 @@ tests = [ testGroup "block elements"
, "strong after emphasis" =: emph (text "foo") <> strong (text "bar") =?> "*foo*<strong>bar</strong>" , "strong after emphasis" =: emph (text "foo") <> strong (text "bar") =?> "*foo*<strong>bar</strong>"
, "strong emphasis after emphasis" =: emph (text "foo") <> strong (emph (text "bar")) =?> "*foo*<strong>*bar*</strong>" , "strong emphasis after emphasis" =: emph (text "foo") <> strong (emph (text "bar")) =?> "*foo*<strong>*bar*</strong>"
, "strong in the end of emphasis" =: emph (text "foo" <> strong (text "bar")) =?> "*foo<strong>bar</strong>*" , "strong in the end of emphasis" =: emph (text "foo" <> strong (text "bar")) =?> "*foo<strong>bar</strong>*"
, "switch to lightweight markup after <em> tag" =:
strong (str "foo") <> emph (str "bar") <> strong (str "baz") =?>
"**foo**<em>bar</em>**baz**"
, "strikeout" =: strikeout (text "foo") =?> "<del>foo</del>" , "strikeout" =: strikeout (text "foo") =?> "<del>foo</del>"
, "space at the beginning of emphasis" =: emph (text " foo") =?> "<em> foo</em>" , "space at the beginning of emphasis" =: emph (text " foo") =?> "<em> foo</em>"
, "space at the end of emphasis" =: emph (text "foo ") =?> "<em>foo </em>" , "space at the end of emphasis" =: emph (text "foo ") =?> "<em>foo </em>"