Muse reader: fix parsing of trailing whitespace
Newline after whitespace now results in softbreak instead of space.
This commit is contained in:
parent
75762ee0dc
commit
248f6076bc
2 changed files with 7 additions and 8 deletions
|
@ -592,7 +592,7 @@ inlineList = [ whitespace
|
|||
]
|
||||
|
||||
inline :: PandocMonad m => MuseParser m (F Inlines)
|
||||
inline = choice [endline, linebreak] <|> choice inlineList <?> "inline"
|
||||
inline = endline <|> choice inlineList <?> "inline"
|
||||
|
||||
endline :: PandocMonad m => MuseParser m (F Inlines)
|
||||
endline = try $ do
|
||||
|
@ -626,13 +626,6 @@ footnote = try $ do
|
|||
let contents' = runF contents st { stateNotes' = M.empty }
|
||||
return $ B.note contents'
|
||||
|
||||
linebreak :: PandocMonad m => MuseParser m (F Inlines)
|
||||
linebreak = try $ do
|
||||
skipMany spaceChar
|
||||
newline
|
||||
notFollowedBy newline
|
||||
return $ return B.space
|
||||
|
||||
whitespace :: PandocMonad m => MuseParser m (F Inlines)
|
||||
whitespace = try $ do
|
||||
skipMany1 spaceChar
|
||||
|
|
|
@ -119,6 +119,12 @@ tests =
|
|||
|
||||
, "Linebreak" =: "Line <br> break" =?> para ("Line" <> linebreak <> "break")
|
||||
|
||||
, "Trailing whitespace inside paragraph" =:
|
||||
T.unlines [ "First line " -- trailing whitespace here
|
||||
, "second line"
|
||||
]
|
||||
=?> para "First line\nsecond line"
|
||||
|
||||
, "Non-breaking space" =: "Foo~~bar" =?> para "Foo\160bar"
|
||||
, "Single ~" =: "Foo~bar" =?> para "Foo~bar"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue