git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: handle type attribute on ol.

E.g. `<ol type="i">`. Closes #2313.

commitda0842b5b5022b31aa22a78bc223e2df86a4f3a5 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 21 Jul 2015, 13:07 (11 years ago) parentf6ad9e2
2 files changed+10−3
src/Text/Pandoc/Readers/HTML.hs+8−1 tests/html-reader.html+2−2
src/Text/Pandoc/Readers/HTML.hs+8−1
@@ -270,7 +270,14 @@ pOrderedList = try $ do
270270 "lower-alpha" -> LowerAlpha
271271 "upper-alpha" -> UpperAlpha
272272 "decimal" -> Decimal
273− _ -> DefaultStyle
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
280+ _ -> DefaultStyle
274281 let nonItem = pSatisfy (\t ->
275282 not (tagOpen (`elem` ["li","ol","ul","dl"]) (const True) t) &&
276283 not (t ~== TagClose "ol"))
tests/html-reader.html+2−2
@@ -259,13 +259,13 @@ These should not be escaped: \$ \\ \> \[ \{
259259 ></ol
260260 ><p
261261 >Nesting:</p
262− ><ol class="upper-alpha"
262+ ><ol type="A"
263263 ><li
264264 >Upper Alpha<ol class="upper-roman"
265265 ><li
266266 >Upper Roman.<ol start="6" class="decimal"
267267 ><li
268− >Decimal start with 6<ol start="3" class="lower-alpha"
268+ >Decimal start with 6<ol start="3" type="a"
269269 ><li
270270 >Lower alpha with paren</li
271271 ></ol