diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-07-21 13:07:52 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-07-21 13:07:52 -0700 |
commit | da0842b5b5022b31aa22a78bc223e2df86a4f3a5 (patch) | |
tree | 19c6641cf66052672e1a765ea2da365e2c92c797 | |
parent | f6ad9e263faac85fd132610ad2c7d9cf4f517091 (diff) | |
download | pandoc-da0842b5b5022b31aa22a78bc223e2df86a4f3a5.tar.gz |
HTML reader: handle type attribute on ol.
E.g. `<ol type="i">`.
Closes #2313.
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 9 | ||||
-rw-r--r-- | 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: \$ \\ \> \[ \{ ></ol ><p >Nesting:</p - ><ol class="upper-alpha" + ><ol type="A" ><li >Upper Alpha<ol class="upper-roman" ><li >Upper Roman.<ol start="6" class="decimal" ><li - >Decimal start with 6<ol start="3" class="lower-alpha" + >Decimal start with 6<ol start="3" type="a" ><li >Lower alpha with paren</li ></ol |