Skip to content

Commit

Permalink
improve indentation of lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikirudennis committed Nov 4, 2024
1 parent 8d93b34 commit 08f19a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,8 @@ def test_github_issue_37():
\t<ul>
\t\t<li><span class="caps">UNITEK</span> Y-3705A Type-C Universal DockingStation Pro</li>
\t\t<li>USB3.0/RJ45/EARPHONE/MICROPHONE/HDMI 6 <span class="caps">PORT</span> <span class="caps">HUB</span> 1.2m Data Cable 5V 4A Power Adaptor
\t\t<ul>
\t\t<li>USB3.0/RJ45/EARPHONE/MICROPHONE/HDMI 6 <span class="caps">PORT</span> <span class="caps">HUB</span> 1.2m Data Cable 5V 4A Power Adaptor</li>
\t\t<li></li>
\t</ul></li>
\t\t<li>Dimensions: 25cm x 13cm x 9cm</li>
\t\t<li>Weight: 0.7kg</li>
\t</ul>'''
Expand Down
8 changes: 4 additions & 4 deletions tests/test_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ def test_nested_list():
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one\n\t\t\t<ul>\n\t\t\t\t<li>point one</li>\n\t\t\t\t<li>point two</li>\n\t\t\t</ul></li>\n\t\t\t<li>moar item</li>\n\t\t</ol></li>\n\t</ol>'
assert result == expect

l = List('ol')
l = List('ol', indent_level=1)
l.add_item('li', 'test')
s1 = List('ol')
s1 = List('ol', indent_level=2)
s1.add_item('li', 'another one')
s2 = List('ul')
s2 = List('ul', indent_level=3)
s2.add_item('li', 'point one')
s2.add_item('li', 'point two')
s1.add_item('li', s2)
s1.add_item('li', 'moar item')
l.add_item('li', s1)
result = l.process()
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t<li>another one\n\t\t<ul>\n\t\t<li>point one</li>\n\t\t<li>point two</li>\n\t</ul></li>\n\t\t<li>moar item</li>\n\t</ol></li>\n\t</ol>'
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one\n\t\t\t<ul>\n\t\t\t\t<li>point one</li>\n\t\t\t\t<li>point two</li>\n\t\t\t</ul></li>\n\t\t\t<li>moar item</li>\n\t\t</ol></li>\n\t</ol>'
assert result == expect

0 comments on commit 08f19a0

Please sign in to comment.