aboutsummaryrefslogtreecommitdiffstats
path: root/markdown_extensions/def_list.py
diff options
context:
space:
mode:
Diffstat (limited to 'markdown_extensions/def_list.py')
-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,