From 45e4b6fe5ce80a04987a5dc688a986d8165bf354 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 13 May 2009 15:28:13 -0400 Subject: Fixed ticket 32. When raw html starts a line, the raw html is only broken into a seperate block if it is a block tag. Inline tags are left in the block for the inline pattern as they should be. --- markdown/preprocessors.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 712a1e8..ef04cab 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -128,7 +128,14 @@ class HtmlBlockPreprocessor(Preprocessor): left_tag = self._get_left_tag(block) right_tag, data_index = self._get_right_tag(left_tag, block) - if data_index < len(block): + if block[1] == "!": + # is a comment block + left_tag = "--" + right_tag, data_index = self._get_right_tag(left_tag, block) + # keep checking conditions below and maybe just append + + if data_index < len(block) \ + and markdown.isBlockLevel(left_tag): text.insert(0, block[data_index:]) block = block[:data_index] @@ -141,12 +148,6 @@ class HtmlBlockPreprocessor(Preprocessor): new_blocks.append(block.strip()) continue - if block[1] == "!": - # is a comment block - left_tag = "--" - right_tag, data_index = self._get_right_tag(left_tag, block) - # keep checking conditions below and maybe just append - if block.rstrip().endswith(">") \ and self._equal_tags(left_tag, right_tag): new_blocks.append( @@ -156,7 +157,7 @@ class HtmlBlockPreprocessor(Preprocessor): # if is block level tag and is not complete if markdown.isBlockLevel(left_tag) or left_tag == "--" \ - and not block.rstrip().endswith(">"): + and not block.rstrip().endswith(">"): items.append(block.strip()) in_tag = True else: -- cgit v1.2.3