Muse writer: check for whitespace in the beginning and end of Str's
This commit is contained in:
parent
cb28cab489
commit
165a61095c
2 changed files with 5 additions and 0 deletions
|
@ -415,11 +415,13 @@ fixNotes (x:xs) = x : fixNotes xs
|
|||
startsWithSpace :: [Inline] -> Bool
|
||||
startsWithSpace (Space:_) = True
|
||||
startsWithSpace (SoftBreak:_) = True
|
||||
startsWithSpace (Str s:_) = stringStartsWithSpace s
|
||||
startsWithSpace _ = False
|
||||
|
||||
endsWithSpace :: [Inline] -> Bool
|
||||
endsWithSpace [Space] = True
|
||||
endsWithSpace [SoftBreak] = True
|
||||
endsWithSpace [Str s] = stringStartsWithSpace $ reverse s
|
||||
endsWithSpace (_:xs) = endsWithSpace xs
|
||||
endsWithSpace [] = False
|
||||
|
||||
|
|
|
@ -382,6 +382,9 @@ tests = [ testGroup "block elements"
|
|||
, "strong empty string" =: strong (str "") =?> "<strong></strong>"
|
||||
, "strong emphasized empty string" =: strong (emph (str "")) =?> "**<em></em>**"
|
||||
, "emphasized strong empty string" =: emph (strong (str "")) =?> "*<strong></strong>*"
|
||||
, "emphasized string with space" =: emph (str " ") =?> "<em> </em>"
|
||||
, "emphasized string ending with space" =: emph (str "foo ") =?> "<em>foo </em>"
|
||||
, "emphasized string with tab" =: emph (str "\t") =?> "<em>\t</em>"
|
||||
, "emphasized space between empty strings" =: emph (str "" <> space <> str "") =?> "<em> </em>"
|
||||
, "strong" =: strong (text "foo") =?> "**foo**"
|
||||
, "strong inside word" =: text "foo" <> strong (text "bar") <> text "baz" =?> "foo<strong>bar</strong>baz"
|
||||
|
|
Loading…
Add table
Reference in a new issue