last_line = line_id
end
if line_id - last_line > 1 or line_id == lines.length - 1
- depth.delete_if do |v|
+ while v = depth.pop
lines[last_line] << "</li>\n\t</#{ lT( v ) }l>"
end
end
)
end
+ def test_nested_lists
+ raw = <<-RAW
+# Item 1
+# Item 2
+** Item 2a
+** Item 2b
+# Item 3
+** Item 3a
+RAW
+
+ expected = <<-EXPECTED
+<ol>
+ <li>Item 1</li>
+ <li>Item 2
+ <ul>
+ <li>Item 2a</li>
+ <li>Item 2b</li>
+ </ul>
+ </li>
+ <li>Item 3
+ <ul>
+ <li>Item 3a</li>
+ </ul>
+ </li>
+</ol>
+EXPECTED
+
+ assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
+ end
+
def test_escaping
assert_html_output(
'this is a <script>' => 'this is a <script>'