diff options
author | Waylan Limberg <waylan@gmail.com> | 2013-09-02 10:22:49 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2013-09-02 10:22:49 -0400 |
commit | 78506014eceb3400d2fee3b39653753fae80939a (patch) | |
tree | 7de25175e7fbdcda144bbd3577eee5284346d7ac | |
parent | 5c4523e7956063d20d517ba9a33853a5541a1396 (diff) | |
download | markdown-78506014eceb3400d2fee3b39653753fae80939a.tar.gz markdown-78506014eceb3400d2fee3b39653753fae80939a.tar.bz2 markdown-78506014eceb3400d2fee3b39653753fae80939a.zip |
Ensure each term on def list maintains its own loose status.
Previously, the code was ignoring whether this was a new term when determining
whether the currect item should be loose or not. Fixes #243. Thanks for the
report @Anomareh.
-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 + |