From da0842b5b5022b31aa22a78bc223e2df86a4f3a5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 21 Jul 2015 13:07:52 -0700 Subject: HTML reader: handle type attribute on ol. E.g. `
    `. Closes #2313. --- src/Text/Pandoc/Readers/HTML.hs | 9 ++++++++- tests/html-reader.html | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 361d64361..c43bc5295 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -270,7 +270,14 @@ pOrderedList = try $ do "lower-alpha" -> LowerAlpha "upper-alpha" -> UpperAlpha "decimal" -> Decimal - _ -> DefaultStyle + _ -> + case lookup "type" attribs of + Just "1" -> Decimal + Just "I" -> UpperRoman + Just "i" -> LowerRoman + Just "A" -> UpperAlpha + Just "a" -> LowerAlpha + _ -> DefaultStyle let nonItem = pSatisfy (\t -> not (tagOpen (`elem` ["li","ol","ul","dl"]) (const True) t) && not (t ~== TagClose "ol")) diff --git a/tests/html-reader.html b/tests/html-reader.html index 749925b2a..b6dd50fcc 100644 --- a/tests/html-reader.html +++ b/tests/html-reader.html @@ -259,13 +259,13 @@ These should not be escaped: \$ \\ \> \[ \{ >

Nesting:

    1. Upper Alpha
      1. Upper Roman.
        1. Decimal start with 6
            Decimal start with 6
            1. Lower alpha with paren