diff options
-rw-r--r-- | markdown/extensions/def_list.py | 2 | ||||
-rw-r--r-- | tests/extensions/extra/loose_def_list.html | 12 | ||||
-rw-r--r-- | tests/extensions/extra/loose_def_list.txt | 11 |
3 files changed, 23 insertions, 2 deletions
diff --git a/markdown/extensions/def_list.py b/markdown/extensions/def_list.py index 8684652..df639df 100644 --- a/markdown/extensions/def_list.py +++ b/markdown/extensions/def_list.py @@ -69,7 +69,7 @@ class DefListProcessor(BlockProcessor): if sibling and sibling.tag == 'dl': # This is another item on an existing list dl = sibling - if len(dl) and dl[-1].tag == 'dd' and len(dl[-1]): + if not terms and len(dl) and dl[-1].tag == 'dd' and len(dl[-1]): state = 'looselist' else: # This is a new list diff --git a/tests/extensions/extra/loose_def_list.html b/tests/extensions/extra/loose_def_list.html index 98fdec8..0de6eb6 100644 --- a/tests/extensions/extra/loose_def_list.html +++ b/tests/extensions/extra/loose_def_list.html @@ -18,4 +18,14 @@ line 2 of def 2-1</p> <p>par 2 of def2-2</p> </dd> </dl> -<p>more text</p>
\ No newline at end of file +<p>more text</p> +<dl> +<dt>term 4</dt> +<dd>not loose</dd> +<dt>term 5</dt> +<dd> +<p>loose</p> +</dd> +<dt>term 6</dt> +<dd>also not loose</dd> +</dl>
\ No newline at end of file diff --git a/tests/extensions/extra/loose_def_list.txt b/tests/extensions/extra/loose_def_list.txt index 24cd6a4..909d12b 100644 --- a/tests/extensions/extra/loose_def_list.txt +++ b/tests/extensions/extra/loose_def_list.txt @@ -18,3 +18,14 @@ term 3 more text +term 4 +: not loose + + +term 5 + +: loose + +term 6 +: also not loose + |