aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-01-24 07:25:16 -0500
committerWaylan Limberg <waylan@gmail.com>2012-01-24 07:25:16 -0500
commitacd09498fbd2b13e65038c96a118fd859a6df235 (patch)
treef16ae3139cc11110f0afd57627a251ec86968655
parente4bb8abf9e1149867545d03722ee59d8e6bdd339 (diff)
downloadmarkdown-acd09498fbd2b13e65038c96a118fd859a6df235.tar.gz
markdown-acd09498fbd2b13e65038c96a118fd859a6df235.tar.bz2
markdown-acd09498fbd2b13e65038c96a118fd859a6df235.zip
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.
-rw-r--r--markdown/blockprocessors.py4
1 files changed, 3 insertions, 1 deletions
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