git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: handle type attribute on ol.
da0842bJohn MacFarlane
src/Text/Pandoc/Readers/HTML.hs+8−1
@@ -270,7 +270,14 @@ pOrderedList = try $ do
270 "lower-alpha" -> LowerAlpha
270 "lower-alpha" -> LowerAlpha
271 "upper-alpha" -> UpperAlpha
271 "upper-alpha" -> UpperAlpha
272 "decimal" -> Decimal
272 "decimal" -> Decimal
273+ _ ->
274+ case lookup "type" attribs of
275+ Just "1" -> Decimal
276+ Just "I" -> UpperRoman
277+ Just "i" -> LowerRoman
278+ Just "A" -> UpperAlpha
279+ Just "a" -> LowerAlpha
273− _ -> DefaultStyle
280+ _ -> DefaultStyle
274 let nonItem = pSatisfy (\t ->
281 let nonItem = pSatisfy (\t ->
275 not (tagOpen (`elem` ["li","ol","ul","dl"]) (const True) t) &&
282 not (tagOpen (`elem` ["li","ol","ul","dl"]) (const True) t) &&
276 not (t ~== TagClose "ol"))
283 not (t ~== TagClose "ol"))
tests/html-reader.html+2−2
@@ -259,13 +259,13 @@ These should not be escaped: \$ \\ \> \[ \{
259 ></ol
259 ></ol
260 ><p
260 ><p
261 >Nesting:</p
261 >Nesting:</p
262− ><ol class="upper-alpha"
262+ ><ol type="A"
263 ><li
263 ><li
264 >Upper Alpha<ol class="upper-roman"
264 >Upper Alpha<ol class="upper-roman"
265 ><li
265 ><li
266 >Upper Roman.<ol start="6" class="decimal"
266 >Upper Roman.<ol start="6" class="decimal"
267 ><li
267 ><li
268− >Decimal start with 6<ol start="3" class="lower-alpha"
268+ >Decimal start with 6<ol start="3" type="a"
269 ><li
269 ><li
270 >Lower alpha with paren</li
270 >Lower alpha with paren</li
271 ></ol
271 ></ol