mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-27 01:45:56 +00:00
HTML reader: find list style anywhere in the class attribute.
Previously `<ol class="fancy lower-roman">` got DefaultStyle, because the whole class attribute was compared against the known style names. Check each class individually. As a side effect, an unrecognized class no longer prevents falling back to the style attribute. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
729a66fa9a
commit
4be508863c
@@ -415,10 +415,14 @@ pOrderedList = try $ do
|
||||
let start = fromMaybe 1 $ lookup "start" attribs >>= safeRead
|
||||
let style = fromMaybe DefaultStyle
|
||||
$ (parseTypeAttr <$> lookup "type" attribs)
|
||||
<|> (parseListStyleType <$> lookup "class" attribs)
|
||||
<|> (lookup "class" attribs >>= pickClassStyle)
|
||||
<|> (parseListStyleType <$> (lookup "style" attribs >>= pickListStyle))
|
||||
where
|
||||
pickListStyle = pickStyleAttrProps ["list-style-type", "list-style"]
|
||||
-- the list style may be one of several words in the class
|
||||
-- attribute:
|
||||
pickClassStyle = L.find (/= DefaultStyle)
|
||||
. map parseListStyleType . T.words
|
||||
|
||||
-- note: if they have an <ol> or <ul> not in scope of a <li>,
|
||||
-- treat it as a list item, though it's not valid xhtml...
|
||||
|
||||
Reference in New Issue
Block a user