aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-09-05 13:59:23 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2015-09-05 13:59:23 -0400
commitf3a68faffae9fd728c689b4732c1d3397d1d3faa (patch)
treee68313e9c551b1998dfc39b7df766f310c58abd5
parentd442f575a35fdf5f7b78df7355c32c4728ff98be (diff)
parent6cd3765a1d60b6557b9f083b4218fe00287a9329 (diff)
downloadmarkdown-f3a68faffae9fd728c689b4732c1d3397d1d3faa.tar.gz
markdown-f3a68faffae9fd728c689b4732c1d3397d1d3faa.tar.bz2
markdown-f3a68faffae9fd728c689b4732c1d3397d1d3faa.zip
Merge pull request #432 from facelessuser/master
Fix infinite loop #430
-rw-r--r--markdown/preprocessors.py7
-rw-r--r--tests/extensions/extra/raw-html.html7
-rw-r--r--tests/extensions/extra/raw-html.txt6
3 files changed, 16 insertions, 4 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py
index 7fd38d3..7ea4fcf 100644
--- a/markdown/preprocessors.py
+++ b/markdown/preprocessors.py
@@ -178,10 +178,11 @@ class HtmlBlockPreprocessor(Preprocessor):
else: # raw html
if len(items) - right_listindex <= 1: # last element
right_listindex -= 1
- offset = 1 if i == right_listindex else 0
+ if right_listindex <= i:
+ right_listindex = i + 1
placeholder = self.markdown.htmlStash.store('\n\n'.join(
- items[i:right_listindex + offset]))
- del items[i:right_listindex + offset]
+ items[i:right_listindex]))
+ del items[i:right_listindex]
items.insert(i, placeholder)
return items
diff --git a/tests/extensions/extra/raw-html.html b/tests/extensions/extra/raw-html.html
index 7acb2ee..9c0222f 100644
--- a/tests/extensions/extra/raw-html.html
+++ b/tests/extensions/extra/raw-html.html
@@ -41,4 +41,9 @@ Raw html blocks may also be nested.
<p>Markdown is <em>still</em> active here.</p>
</div>
-<p>Markdown is <em>active again</em> here.</p> \ No newline at end of file
+<p>Markdown is <em>active again</em> here.</p>
+<div>
+<p>foo bar</p>
+<p><em>bar</em>
+</p>
+</div> \ No newline at end of file
diff --git a/tests/extensions/extra/raw-html.txt b/tests/extensions/extra/raw-html.txt
index 72f530b..da24af0 100644
--- a/tests/extensions/extra/raw-html.txt
+++ b/tests/extensions/extra/raw-html.txt
@@ -65,3 +65,9 @@ Markdown is *still* active here.
</div>
Markdown is *active again* here.
+
+<div markdown=1>
+foo bar
+
+<em>bar</em>
+</div>