aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-12-29 16:19:46 -0500
committerWaylan Limberg <waylan@gmail.com>2011-12-29 16:19:46 -0500
commit400ebc2efe38178a4817cd5517d8c9d89ee3a5a7 (patch)
tree4c11d5665d3a803fb47ec06ee115538f4fafac8b
parent07bc7a4c8f2e834e0f8150de004c1f8fd98a3d60 (diff)
downloadmarkdown-400ebc2efe38178a4817cd5517d8c9d89ee3a5a7.tar.gz
markdown-400ebc2efe38178a4817cd5517d8c9d89ee3a5a7.tar.bz2
markdown-400ebc2efe38178a4817cd5517d8c9d89ee3a5a7.zip
Fixed #57. Multiline HTML Blocks no longer require a blank line after them.
-rw-r--r--markdown/preprocessors.py9
-rw-r--r--tests/misc/multi-line-tags.html10
-rw-r--r--tests/misc/multi-line-tags.txt7
-rw-r--r--tests/misc/multiline-comments.html2
4 files changed, 25 insertions, 3 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py
index 28f731f..a80f9fb 100644
--- a/markdown/preprocessors.py
+++ b/markdown/preprocessors.py
@@ -202,14 +202,21 @@ class HtmlBlockPreprocessor(Preprocessor):
new_blocks.append(block)
else:
+ #import pdb; pdb.set_trace()
items.append(block)
right_tag, data_index = self._get_right_tag(left_tag,
- left_index,
+ 0,
block)
if self._equal_tags(left_tag, right_tag):
# if find closing tag
+
+ if data_index < len(block):
+ # we have more text after right_tag
+ items[-1] = block[:data_index]
+ text.insert(0, block[data_index:])
+
in_tag = False
if self.markdown_in_raw and 'markdown' in attrs.keys():
start = re.sub(r'\smarkdown(=[\'"]?[^> ]*[\'"]?)?',
diff --git a/tests/misc/multi-line-tags.html b/tests/misc/multi-line-tags.html
index 784c1dd..69899aa 100644
--- a/tests/misc/multi-line-tags.html
+++ b/tests/misc/multi-line-tags.html
@@ -2,4 +2,12 @@
asdf asdfasd
-</div> \ No newline at end of file
+</div>
+
+<div>
+
+foo bar
+
+</div>
+
+<p>No blank line.</p> \ No newline at end of file
diff --git a/tests/misc/multi-line-tags.txt b/tests/misc/multi-line-tags.txt
index 4ea3b02..9056473 100644
--- a/tests/misc/multi-line-tags.txt
+++ b/tests/misc/multi-line-tags.txt
@@ -4,3 +4,10 @@
asdf asdfasd
</div>
+
+<div>
+
+foo bar
+
+</div>
+No blank line.
diff --git a/tests/misc/multiline-comments.html b/tests/misc/multiline-comments.html
index 12f8cb5..29c17e9 100644
--- a/tests/misc/multiline-comments.html
+++ b/tests/misc/multiline-comments.html
@@ -2,7 +2,7 @@
foo
--->
+-->
<p>