git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: count only one space as part of list item marker
82bcda8Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+2−2
@@ -392,8 +392,8 @@ listStart marker = try $ do
392 st <- stateParserContext <$> getState
392 st <- stateParserContext <$> getState
393 getPosition >>= \pos -> guard (st == ListItemState || sourceColumn pos /= 1)
393 getPosition >>= \pos -> guard (st == ListItemState || sourceColumn pos /= 1)
394 markerLength <- marker
394 markerLength <- marker
395− postWhitespace <- length <$> many1 spaceChar
395+ many1 spaceChar
396− return $ preWhitespace + markerLength + postWhitespace
396+ return $ preWhitespace + markerLength + 1
397
397
398listItemContents :: PandocMonad m => Int -> MuseParser m (F Blocks)
398listItemContents :: PandocMonad m => Int -> MuseParser m (F Blocks)
399listItemContents markerLength = do
399listItemContents markerLength = do
test/Tests/Readers/Muse.hs+36−22
@@ -527,28 +527,42 @@ tests =
527 orderedListWith (1, Decimal, Period) [ para "Item1"
527 orderedListWith (1, Decimal, Period) [ para "Item1"
528 , para "Item2"
528 , para "Item2"
529 ]
529 ]
530− , "Nested list" =:
530+ , testGroup "Nested lists"
531+ [ "Nested list" =:
531− T.unlines
532+ T.unlines
532− [ " - Item1"
533+ [ " - Item1"
533− , " - Item2"
534+ , " - Item2"
534− , " - Item3"
535+ , " - Item3"
535− , " - Item4"
536+ , " - Item4"
536− , " 1. Nested"
537+ , " 1. Nested"
537− , " 2. Ordered"
538+ , " 2. Ordered"
538− , " 3. List"
539+ , " 3. List"
539− ] =?>
540+ ] =?>
540− bulletList [ mconcat [ para "Item1"
541+ bulletList [ mconcat [ para "Item1"
541− , bulletList [ para "Item2"
542+ , bulletList [ para "Item2"
542− , para "Item3"
543+ , para "Item3"
543− ]
544+ ]
544− ]
545+ ]
545− , mconcat [ para "Item4"
546+ , mconcat [ para "Item4"
546− , orderedListWith (1, Decimal, Period) [ para "Nested"
547+ , orderedListWith (1, Decimal, Period) [ para "Nested"
547− , para "Ordered"
548+ , para "Ordered"
548− , para "List"
549+ , para "List"
550+ ]
549− ]
551+ ]
550− ]
552+ ]
553+ , "Incorrectly indented Text::Amuse nested list" =:
554+ T.unlines
555+ [ " - First item"
556+ , " - Not nested item"
557+ ] =?>
558+ bulletList [ para "First item", para "Not nested item"]
559+ , "Text::Amuse includes only one space in list marker" =:
560+ T.unlines
561+ [ " - First item"
562+ , " - Nested item"
563+ ] =?>
564+ bulletList [ para "First item" <> bulletList [ para "Nested item"]]
551− ]
565+ ]
552 , "List continuation" =:
566 , "List continuation" =:
553 T.unlines
567 T.unlines
554 [ " - a"
568 [ " - a"