Skip to content

Commit

Permalink
fix does not work with a single list item
Browse files Browse the repository at this point in the history
  • Loading branch information
hmagdy committed Apr 3, 2018
1 parent 0465b42 commit 6184924
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/markdown2.py
Expand Up @@ -2056,8 +2056,13 @@ def _form_paragraphs(self, text):
# text (issue 33). Note the `[-1]` is a quick way to
# consider numeric bullets (e.g. "1." and "2.") to be
# equal.
if (li and len(li.group(2)) <= 3 and li.group("next_marker")
and li.group("marker")[-1] == li.group("next_marker")[-1]):
if (li and len(li.group(2)) <= 3
and (
(li.group("next_marker") and li.group("marker")[-1] == li.group("next_marker")[-1])
or
li.group("next_marker") is None
)
):
start = li.start()
cuddled_list = self._do_lists(graf[start:]).rstrip("\n")
assert cuddled_list.startswith("<ul>") or cuddled_list.startswith("<ol>")
Expand Down

0 comments on commit 6184924

Please sign in to comment.