aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-07-21 10:23:16 -0400
committerWaylan Limberg <waylan@gmail.com>2011-07-21 10:23:16 -0400
commit9927620f789ffc33082e631e532e9ca21eb15fc7 (patch)
tree959249996492334bc27b261177932678ca4072ab
parentbe3627f5b1f3a7df806a899337a74648edfef76a (diff)
downloadmarkdown-9927620f789ffc33082e631e532e9ca21eb15fc7.tar.gz
markdown-9927620f789ffc33082e631e532e9ca21eb15fc7.tar.bz2
markdown-9927620f789ffc33082e631e532e9ca21eb15fc7.zip
Fixed #31. Headers in tight lists now get inline patterns run on their tails. Tests included.
-rw-r--r--markdown/treeprocessors.py13
-rw-r--r--tests/misc/header-in-lists.html4
-rw-r--r--tests/misc/header-in-lists.txt4
3 files changed, 16 insertions, 5 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py
index 4ce8166..3340554 100644
--- a/markdown/treeprocessors.py
+++ b/markdown/treeprocessors.py
@@ -289,7 +289,18 @@ class InlineProcessor(Treeprocessor):
text), child)
stack += lst
insertQueue.append((child, lst))
-
+ if child.tail:
+ tail = self.__handleInline(child.tail)
+ dumby = util.etree.Element('d')
+ tailResult = self.__processPlaceholders(tail, dumby)
+ if dumby.text:
+ child.tail = dumby.text
+ else:
+ child.tail = None
+ pos = currElement.getchildren().index(child) + 1
+ tailResult.reverse()
+ for newChild in tailResult:
+ currElement.insert(pos, newChild)
if child.getchildren():
stack.append(child)
diff --git a/tests/misc/header-in-lists.html b/tests/misc/header-in-lists.html
index 61a6d97..351b44a 100644
--- a/tests/misc/header-in-lists.html
+++ b/tests/misc/header-in-lists.html
@@ -2,7 +2,7 @@
<ul>
<li>
<h1>Header1</h1>
-Line 1-2 - not a header or paragraph!</li>
+Line 1-2 - <strong>not</strong> a header <em>or</em> paragraph!</li>
<li>
<h1>Header2</h1>
Line 2-2 - not a header or paragraph!</li>
@@ -11,7 +11,7 @@ Line 2-2 - not a header or paragraph!</li>
<ul>
<li>
<h1>Header1</h1>
-<p>Line 1-2 - a paragraph</p>
+<p>Line 1-2 - <em>a</em> paragraph</p>
</li>
<li>
<h1>Header2</h1>
diff --git a/tests/misc/header-in-lists.txt b/tests/misc/header-in-lists.txt
index b633d8a..b22083e 100644
--- a/tests/misc/header-in-lists.txt
+++ b/tests/misc/header-in-lists.txt
@@ -1,14 +1,14 @@
Tight List:
* #Header1
-Line 1-2 - not a header or paragraph!
+Line 1-2 - **not** a header *or* paragraph!
* #Header2
Line 2-2 - not a header or paragraph!
Loose List:
* #Header1
-Line 1-2 - a paragraph
+Line 1-2 - *a* paragraph
* #Header2
Line 2-2 - a paragraph