diff options
author | Waylan Limberg <waylan@gmail.com> | 2010-03-24 22:17:26 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2010-03-24 22:17:26 -0400 |
commit | 0c09523c55ab40ba628501740eec0423d4c87a86 (patch) | |
tree | 0b59dc0055298b415ac65158dc0525832c668f00 /markdown/extensions/def_list.py | |
parent | 1599e909fd5c7a80f51247d7232c7627693206e6 (diff) | |
download | markdown-0c09523c55ab40ba628501740eec0423d4c87a86.tar.gz markdown-0c09523c55ab40ba628501740eec0423d4c87a86.tar.bz2 markdown-0c09523c55ab40ba628501740eec0423d4c87a86.zip |
Fixed Ticket 60. The dd in definition lists can now not be indented on secondary lines.
Diffstat (limited to 'markdown/extensions/def_list.py')
-rw-r--r-- | markdown/extensions/def_list.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/markdown/extensions/def_list.py b/markdown/extensions/def_list.py index 73a1c85..bd04b03 100644 --- a/markdown/extensions/def_list.py +++ b/markdown/extensions/def_list.py @@ -27,6 +27,7 @@ class DefListProcessor(markdown.blockprocessors.BlockProcessor): """ Process Definition Lists. """ RE = re.compile(r'(^|\n)[ ]{0,3}:[ ]{1,3}(.*?)(\n|$)') + NO_INDENT_RE = re.compile(r'^[ ]{0,3}[^ :]') def test(self, parent, block): return bool(self.RE.search(block)) @@ -35,12 +36,16 @@ class DefListProcessor(markdown.blockprocessors.BlockProcessor): block = blocks.pop(0) m = self.RE.search(block) terms = [l.strip() for l in block[:m.start()].split('\n') if l.strip()] - d, theRest = self.detab(block[m.end():]) + block = block[m.end():] + no_indent = self.NO_INDENT_RE.match(block) + if no_indent: + d, theRest = (block, None) + else: + d, theRest = self.detab(block) if d: d = '%s\n%s' % (m.group(2), d) else: d = m.group(2) - #import ipdb; ipdb.set_trace() sibling = self.lastChild(parent) if not terms and sibling.tag == 'p': # The previous paragraph contains the terms |