Muse writer: don't align ordered list items

It leads to problems with round-trip test,
because aligned line blocks can't be read back.
This commit is contained in:
Alexander Krotov 2018-03-21 17:32:12 +03:00
parent f12348cab5
commit 6f50733691
3 changed files with 10 additions and 13 deletions

View file

@ -175,10 +175,7 @@ blockToMuse (BlockQuote blocks) = do
blockToMuse (OrderedList (start, style, _) items) = do
let markers = take (length items) $ orderedListMarkers
(start, style, Period)
let maxMarkerLength = maximum $ map length markers
let markers' = map (\m -> let s = maxMarkerLength - length m
in m ++ replicate s ' ') markers
contents <- zipWithM orderedListItemToMuse markers' items
contents <- zipWithM orderedListItemToMuse markers items
-- ensure that sublists have preceding blank line
topLevel <- gets stTopLevel
return $ cr $$ (if topLevel then nest 1 else id) (vcat contents) $$ blankline

View file

@ -74,8 +74,8 @@ tests = [ testGroup "block elements"
, plain $ text "second"
, plain $ text "third"
]
=?> unlines [ " I. first"
, " II. second"
=?> unlines [ " I. first"
, " II. second"
, " III. third"
]
, "bullet list" =: bulletList [ plain $ text "first"
@ -138,11 +138,11 @@ tests = [ testGroup "block elements"
orderedListWith (1, UpperRoman, DefaultDelim) [ para $ text "Third"
, para $ text "Fourth"
] =?>
unlines [ " I. First"
unlines [ " I. First"
, " II. Second"
, ""
, ""
, " I. Third"
, " I. Third"
, " II. Fourth"
]
, "ordered lists with equal styles" =:
@ -169,7 +169,7 @@ tests = [ testGroup "block elements"
unlines [ " - First"
, " - Second"
, ""
, " I. Third"
, " I. Third"
, " II. Fourth"
]
, "different style ordered lists" =:
@ -179,7 +179,7 @@ tests = [ testGroup "block elements"
orderedListWith (1, Decimal, DefaultDelim) [ para $ text "Third"
, para $ text "Fourth"
] =?>
unlines [ " I. First"
unlines [ " I. First"
, " II. Second"
, ""
, " 1. Third"

View file

@ -224,9 +224,9 @@ Same thing but with paragraphs:
with a continuation
iv. sublist with roman numerals, starting with 4
v. more items
A. a subsublist
B. a subsublist
v. more items
A. a subsublist
B. a subsublist
Nesting: