aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/blockprocessors.py28
-rw-r--r--tests/misc/lists8.html39
-rw-r--r--tests/misc/lists8.txt16
3 files changed, 58 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 = []
diff --git a/tests/misc/lists8.html b/tests/misc/lists8.html
new file mode 100644
index 0000000..8a93a51
--- /dev/null
+++ b/tests/misc/lists8.html
@@ -0,0 +1,39 @@
+<h1>Lists with blockquotes</h1>
+<ol>
+<li>
+<blockquote>
+<p>Four-score and seven years ago...</p>
+</blockquote>
+</li>
+<li>
+<blockquote>
+<p>We have nothing to fear...</p>
+</blockquote>
+</li>
+<li>
+<blockquote>
+<p>This is it...</p>
+</blockquote>
+</li>
+</ol>
+<h1>Multi-line blockquotes</h1>
+<ul>
+<li>
+<blockquote>
+<p>Four-score and sever years ago
+our fathers brought forth</p>
+</blockquote>
+</li>
+<li>
+<blockquote>
+<p>We have nothing to fear
+but fear itself</p>
+</blockquote>
+</li>
+<li>
+<blockquote>
+<p>This is it
+as far as I'm concerned</p>
+</blockquote>
+</li>
+</ul> \ No newline at end of file
diff --git a/tests/misc/lists8.txt b/tests/misc/lists8.txt
new file mode 100644
index 0000000..8ab6767
--- /dev/null
+++ b/tests/misc/lists8.txt
@@ -0,0 +1,16 @@
+# Lists with blockquotes
+1. > Four-score and seven years ago...
+
+2. > We have nothing to fear...
+
+3. > This is it...
+
+# Multi-line blockquotes
+* > Four-score and sever years ago
+ > our fathers brought forth
+
+* > We have nothing to fear
+ > but fear itself
+
+* > This is it
+ > as far as I'm concerned