aboutsummaryrefslogtreecommitdiffstats
path: root/markdown_extensions
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-04 18:54:09 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-04 18:54:09 -0500
commit47c8ba4a561d0100feebca93ff0f288757e6e69d (patch)
treeff595a660c7245fb14ab585cf4bb6cace618fa5e /markdown_extensions
parenta4106db7aff9e961f0c40a738f19ccf06a7cae6c (diff)
downloadmarkdown-47c8ba4a561d0100feebca93ff0f288757e6e69d.tar.gz
markdown-47c8ba4a561d0100feebca93ff0f288757e6e69d.tar.bz2
markdown-47c8ba4a561d0100feebca93ff0f288757e6e69d.zip
Added support to Definition List extension for blank lines between terms and first def. Includes tests. That was easier than expected.
Diffstat (limited to 'markdown_extensions')
-rw-r--r--markdown_extensions/def_list.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/markdown_extensions/def_list.py b/markdown_extensions/def_list.py
index a988e13..30e0f82 100644
--- a/markdown_extensions/def_list.py
+++ b/markdown_extensions/def_list.py
@@ -99,9 +99,16 @@ class DefListParser(markdown.MarkdownParser):
elif paragraph:
terms, defs, paragraph = self._getDefs(paragraph)
if defs:
+ if not terms:
+ # The previous paragraph must be the terms
+ c = parent_elem.getchildren()
+ if c and c[-1].tag == "p" and c[-1].text:
+ terms = c[-1].text.split("\n")
+ parent_elem.remove(c[-1])
# check for extra paragraphs of a def
extradef, lines = self.detectTabbed(lines)
defs[-1].extend(extradef)
+ # process the terms and defs
self._processDef(parent_elem, terms, defs)
if len(paragraph):
self._MarkdownParser__processParagraph(parent_elem,