From 5d913699758a5815bc114a9e8c08db61eb206a5d Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 19 Nov 2014 18:21:40 -0700 Subject: Issue #368: Fix Markdown in raw HTML stops working Originally there was an infinite loop issue that was patched in issue #308. Unfortunately, it was fixed all the way. This fix patches the infinite loop fix to only add an offset to the `right_listindex` when it is in a infinite loop scenario. --- markdown/preprocessors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'markdown/preprocessors.py') diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 4a1fac5..ed11c39 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -174,9 +174,10 @@ 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 placeholder = self.markdown.htmlStash.store('\n\n'.join( - items[i:right_listindex + 1])) - del items[i:right_listindex + 1] + items[i:right_listindex + offset])) + del items[i:right_listindex + offset] items.insert(i, placeholder) return items -- cgit v1.2.3