From acd09498fbd2b13e65038c96a118fd859a6df235 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Tue, 24 Jan 2012 07:25:16 -0500 Subject: Provide more control to list processors subclasses. This will make it easier for extensions to subclass the list block processors and alter their behavior. Such as the request in issue #64. --- markdown/blockprocessors.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py index de3f136..7b14a85 100644 --- a/markdown/blockprocessors.py +++ b/markdown/blockprocessors.py @@ -306,6 +306,8 @@ class OListProcessor(BlockProcessor): # 3. Item # The ol tag will get starts="3" attribute STARTSWITH = '1' + # List of allowed sibling tags. + SIBLING_TAGS = ['ol', 'ul'] def test(self, parent, block): return bool(self.RE.match(block)) @@ -315,7 +317,7 @@ class OListProcessor(BlockProcessor): items = self.get_items(blocks.pop(0)) sibling = self.lastChild(parent) - if sibling and sibling.tag in ['ol', 'ul']: + if sibling and sibling.tag in self.SIBLING_TAGS: # Previous block was a list item, so set that as parent lst = sibling # make sure previous item is in a p- if the item has text, then it -- cgit v1.2.3