From ca0bb5123e52b89b39033a54120626062e824ca5 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 21 Sep 2018 12:46:36 +0300 Subject: Muse reader: simplify ordered list parsing --- src/Text/Pandoc/Readers/Muse.hs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 6cb732c42..9c6c24f08 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -595,13 +595,6 @@ bulletListUntil end = try $ do (items, e) <- bulletListItemsUntil indent end return (B.bulletList <$> sequence items, e) --- | Parses an ordered list marker and returns list attributes. -anyMuseOrderedListMarker :: PandocMonad m => MuseParser m ListAttributes -anyMuseOrderedListMarker = do - (style, start) <- decimal <|> lowerRoman <|> upperRoman <|> lowerAlpha <|> upperAlpha - char '.' - return (start, style, Period) - museOrderedListMarker :: PandocMonad m => ListNumberStyle -> MuseParser m Int @@ -639,10 +632,10 @@ orderedListUntil end = try $ do pos <- getPosition let indent = sourceColumn pos - 1 guard $ indent /= 0 - p@(_, style, _) <- anyMuseOrderedListMarker - guard $ style `elem` [Decimal, LowerAlpha, UpperAlpha, LowerRoman, UpperRoman] - (items, e) <- orderedListItemsUntil indent style end - return (B.orderedListWith p <$> sequence items, e) + (style, start) <- decimal <|> lowerRoman <|> upperRoman <|> lowerAlpha <|> upperAlpha + char '.' + first (fmap (B.orderedListWith (start, style, Period)) . sequence) + <$> orderedListItemsUntil indent style end descriptionsUntil :: PandocMonad m => Int -- cgit v1.2.3