aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-12-30 05:19:46 +0800
committerMike Dirolf <mike@dirolf.com>2012-01-15 00:45:37 +0800
commit44caa3aaa1022532f3ecdada6cff7fe5fd0a2c44 (patch)
treefce55fb4b41b50ce8426b7e83a351bd1bc920d44
parent5f959a21dac3a0245630a201f11fe95fb43c725f (diff)
downloadmarkdown-44caa3aaa1022532f3ecdada6cff7fe5fd0a2c44.tar.gz
markdown-44caa3aaa1022532f3ecdada6cff7fe5fd0a2c44.tar.bz2
markdown-44caa3aaa1022532f3ecdada6cff7fe5fd0a2c44.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>