Skip to content

HTML reader does not interpret type attribute on <ol> #2313

Closed
adunning opened this Issue · 4 comments

3 participants

@adunning

The HTML reader does not interpret the type attribute on <ol> (output by the HTML5 writer), as in the following case (version 1.15.0.6):

pandoc -f html -t markdown << EOT
<ol type="1">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<ol type="I">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<ol type="i">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<ol type="A">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
<ol type="a">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
EOT

This is the result:

1.  One
2.  Two
3.  Three

<!-- -->

1.  One
2.  Two
3.  Three

<!-- -->

1.  One
2.  Two
3.  Three

<!-- -->

1.  One
2.  Two
3.  Three

<!-- -->

1.  One
2.  Two
3.  Three
@adunning

Am I missing something here? Given either of these commands:

pandoc -f markdown -t html5 << EOT | pandoc -f html -t markdown

pandoc -f markdown -t html << EOT | pandoc -f html -t markdown

I would expect the following to return identical results:

1.  One
2.  Two

<!-- -->

I.  One
II. Two

<!-- -->

i.  One
ii. Two

<!-- -->

A.  One
B.  Two

<!-- -->

a.  One
b.  Two

EOT

Instead, I receive the following in both cases:

1.  One
2.  Two

<!-- -->

1.  One
2.  Two

<!-- -->

1.  One
2.  Two

<!-- -->

1.  One
2.  Two

<!-- -->

1.  One
2.  Two
@jgm jgm added a commit that closed this issue
@jgm HTML reader: handle type attribute on ol.
E.g. `<ol type="i">`.

Closes #2313.
da0842b
@jgm jgm closed this in da0842b
@hftf

Oops, should have said I started fixing this bug. FYI, I think the nearby lookup "style" code (added in e814a3f from 8 years ago) doesn't work as intended:

$ cat <<EOF > foo
<ol class="lower-roman"></ol>
<ol style="lower-roman"></ol>
<ol style="list-style: lower-roman;"></ol>
<ol style="list-style-type: lower-roman;"></ol>
EOF
$ pandoc -f html -t native foo
[OrderedList (1,LowerRoman,DefaultDelim)
 []
,OrderedList (1,LowerRoman,DefaultDelim)
 []
,OrderedList (1,DefaultStyle,DefaultDelim)
 []
,OrderedList (1,DefaultStyle,DefaultDelim)
 []]

I also had trouble running the HTML tests using only cabal test. It seems I needed to completely install pandoc before my changes were used.

@jgm
Owner
@jgm
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.