Muse reader: count only one space as part of list item marker

This commit is contained in:
Alexander Krotov 2017-11-19 04:26:45 +03:00
parent 163af3fdee
commit 82bcda80c6
2 changed files with 38 additions and 24 deletions

View file

@ -392,8 +392,8 @@ listStart marker = try $ do
st <- stateParserContext <$> getState
getPosition >>= \pos -> guard (st == ListItemState || sourceColumn pos /= 1)
markerLength <- marker
postWhitespace <- length <$> many1 spaceChar
return $ preWhitespace + markerLength + postWhitespace
many1 spaceChar
return $ preWhitespace + markerLength + 1
listItemContents :: PandocMonad m => Int -> MuseParser m (F Blocks)
listItemContents markerLength = do

View file

@ -527,28 +527,42 @@ tests =
orderedListWith (1, Decimal, Period) [ para "Item1"
, para "Item2"
]
, "Nested list" =:
T.unlines
[ " - Item1"
, " - Item2"
, " - Item3"
, " - Item4"
, " 1. Nested"
, " 2. Ordered"
, " 3. List"
] =?>
bulletList [ mconcat [ para "Item1"
, bulletList [ para "Item2"
, para "Item3"
]
]
, mconcat [ para "Item4"
, orderedListWith (1, Decimal, Period) [ para "Nested"
, para "Ordered"
, para "List"
]
]
]
, testGroup "Nested lists"
[ "Nested list" =:
T.unlines
[ " - Item1"
, " - Item2"
, " - Item3"
, " - Item4"
, " 1. Nested"
, " 2. Ordered"
, " 3. List"
] =?>
bulletList [ mconcat [ para "Item1"
, bulletList [ para "Item2"
, para "Item3"
]
]
, mconcat [ para "Item4"
, orderedListWith (1, Decimal, Period) [ para "Nested"
, para "Ordered"
, para "List"
]
]
]
, "Incorrectly indented Text::Amuse nested list" =:
T.unlines
[ " - First item"
, " - Not nested item"
] =?>
bulletList [ para "First item", para "Not nested item"]
, "Text::Amuse includes only one space in list marker" =:
T.unlines
[ " - First item"
, " - Nested item"
] =?>
bulletList [ para "First item" <> bulletList [ para "Nested item"]]
]
, "List continuation" =:
T.unlines
[ " - a"