Muse writer: do not insert newline before lists

This commit is contained in:
Alexander Krotov 2018-10-23 03:38:19 +03:00
parent 1d3460c0b0
commit 4275d58a9f
2 changed files with 4 additions and 3 deletions

View file

@ -201,7 +201,7 @@ blockToMuse (OrderedList (start, style, _) items) = do
contents <- zipWithM orderedListItemToMuse markers items
-- ensure that sublists have preceding blank line
topLevel <- asks envTopLevel
return $ cr $$ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
return $ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
where orderedListItemToMuse :: PandocMonad m
=> String -- ^ marker for list item
-> [Block] -- ^ list item (list of blocks)
@ -212,7 +212,7 @@ blockToMuse (BulletList items) = do
contents <- mapM bulletListItemToMuse items
-- ensure that sublists have preceding blank line
topLevel <- asks envTopLevel
return $ cr $$ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
return $ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
where bulletListItemToMuse :: PandocMonad m
=> [Block]
-> Muse m Doc
@ -223,7 +223,7 @@ blockToMuse (DefinitionList items) = do
contents <- mapM definitionListItemToMuse items
-- ensure that sublists have preceding blank line
topLevel <- asks envTopLevel
return $ cr $$ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
return $ (if topLevel then nest 1 else id) (vcat contents) $$ blankline
where definitionListItemToMuse :: PandocMonad m
=> ([Inline], [[Block]])
-> Muse m Doc

View file

@ -247,6 +247,7 @@ tests = [ testGroup "block elements"
, " first inner definition :: first inner description"
, " second inner definition :: second inner description"
]
, "list item starting with list" =: bulletList [ bulletList [ plain $ text "foo"] ] =?> " - - foo"
]
-- Check that list is intended with one space even inside a quote
, "List inside block quote" =: blockQuote (orderedList [ plain $ text "first"