aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/blockprocessors.py
diff options
context:
space:
mode:
authorGerry LaMontagne <gjlama94@gmail.com>2010-03-23 13:41:41 -0400
committerGerry LaMontagne <gjlama94@gmail.com>2010-03-23 13:41:41 -0400
commit3c5a355edd62efb8642b71b28cd39f7f8f2b3dc6 (patch)
tree6bbf7e962e9f8fd557e203d1afdf7ebec875e881 /markdown/blockprocessors.py
parentced8f58b78b02a58e20f6863085ef9c7d82182e0 (diff)
downloadmarkdown-3c5a355edd62efb8642b71b28cd39f7f8f2b3dc6.tar.gz
markdown-3c5a355edd62efb8642b71b28cd39f7f8f2b3dc6.tar.bz2
markdown-3c5a355edd62efb8642b71b28cd39f7f8f2b3dc6.zip
Blockquoted text in the first item of a list is now placed in child p tag of the
blockquote tag. Added lists8.txt and .html for test suite to test condition.
Diffstat (limited to 'markdown/blockprocessors.py')
-rw-r--r--markdown/blockprocessors.py28
1 files changed, 3 insertions, 25 deletions
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py
index f73a4d8..7e6860f 100644
--- a/markdown/blockprocessors.py
+++ b/markdown/blockprocessors.py
@@ -127,20 +127,10 @@ class ListIndentProcessor(BlockProcessor):
)
def run(self, parent, blocks):
- print "BEGIN ListIndentProcessor"
- print "parent: %s" % markdown.etree.tostring(parent)
- print "blocks: %s" % blocks
-
block = blocks.pop(0)
level, sibling = self.get_level(parent, block)
block = self.looseDetab(block, level)
- print "block: %s" % block
- if sibling:
- print "sibling: %s" % markdown.etree.tostring(sibling)
- else:
- print "sibling: none"
-
self.parser.state.set('detabbed')
if parent.tag in self.ITEM_TYPES:
# It's possible that this parent has a 'ul' or 'ol' child list
@@ -172,8 +162,6 @@ class ListIndentProcessor(BlockProcessor):
self.create_item(sibling, block)
self.parser.state.reset()
- print "END ListIndentProcessor"
-
def create_item(self, parent, block):
""" Create a new li and parse the block with it as the parent. """
li = markdown.etree.SubElement(parent, 'li')
@@ -263,7 +251,10 @@ class BlockQuoteProcessor(BlockProcessor):
# This is a new blockquote. Create a new parent element.
quote = markdown.etree.SubElement(parent, 'blockquote')
# Recursively parse block with blockquote as parent.
+ # change parser state so blockquotes embedded in lists use p tags
+ self.parser.state.set('blockquote')
self.parser.parseChunk(quote, block)
+ self.parser.state.reset()
def clean(self, line):
""" Remove ``>`` from beginning of a line. """
@@ -290,20 +281,10 @@ class OListProcessor(BlockProcessor):
return bool(self.RE.match(block))
def run(self, parent, blocks):
- print "BEGIN OListProcessor"
- print "parent: %s" % markdown.etree.tostring(parent)
- print "blocks: %s" % blocks
-
# Check fr multiple items in one block.
items = self.get_items(blocks.pop(0))
sibling = self.lastChild(parent)
- print "items: %s" % items
- if sibling:
- print "sibling: %s" % markdown.etree.tostring(sibling)
- else:
- print "sibling: none"
-
if sibling and sibling.tag in ['ol', 'ul']:
# Previous block was a list item, so set that as parent
lst = sibling
@@ -323,7 +304,6 @@ class OListProcessor(BlockProcessor):
self.parser.state.set('looselist')
firstitem = items.pop(0)
self.parser.parseBlocks(li, [firstitem])
- print "looselist: %s" % markdown.etree.tostring(lst)
self.parser.state.reset()
elif parent.tag in ['ol', 'ul']:
# this catches the edge case of a multi-item indented list whose
@@ -348,8 +328,6 @@ class OListProcessor(BlockProcessor):
self.parser.parseBlocks(li, [item])
self.parser.state.reset()
- print "END OListProcessor"
-
def get_items(self, block):
""" Break a block into list items. """
items = []