@@ -46,7 +46,7 @@ import Text.HTML.TagSoup.Match
4646import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
4747import qualified Text.Pandoc.Builder as B
4848import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
49−import Text.Pandoc.CSS (foldOrElse, pickStyleAttrProps)
49+import Text.Pandoc.CSS (pickStyleAttrProps)
5050import qualified Text.Pandoc.UTF8 as UTF8
5151import Text.Pandoc.Definition
5252import Text.Pandoc.Readers.HTML.Parsing
@@ -290,23 +290,14 @@ pOrderedList :: PandocMonad m => TagParser m Blocks
290290pOrderedList = try $ do
291291 TagOpen _ attribs' <- pSatisfy (matchTagOpen "ol" [])
292292 let attribs = toStringAttr attribs'
293− let (start, style) = (sta', sty')
294− where sta = fromMaybe "1" $
295− lookup "start" attribs
296− sta' = fromMaybe 1 $ safeRead sta
297−
298− pickListStyle = pickStyleAttrProps ["list-style-type", "list-style"]
299−
300− typeAttr = fromMaybe "" $ lookup "type" attribs
301− classAttr = fromMaybe "" $ lookup "class" attribs
302− styleAttr = fromMaybe "" $ lookup "style" attribs
303− listStyle = fromMaybe "" $ pickListStyle styleAttr
304−
305− sty' = foldOrElse DefaultStyle
306− [ parseTypeAttr typeAttr
307− , parseListStyleType classAttr
308− , parseListStyleType listStyle
309− ]
293+ let start = fromMaybe 1 $ lookup "start" attribs >>= safeRead
294+ let style = fromMaybe DefaultStyle
295+ $ (parseTypeAttr <$> lookup "type" attribs)
296+ <|> (parseListStyleType <$> lookup "class" attribs)
297+ <|> (parseListStyleType <$> (lookup "style" attribs >>= pickListStyle))
298+ where
299+ pickListStyle = pickStyleAttrProps ["list-style-type", "list-style"]
300+
310301 let nonItem = pSatisfy (\t ->
311302 not (tagOpen (`elem` ["li","ol","ul","dl"]) (const True) t) &&
312303 not (matchTagClose "ol" t))