aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-05-13 15:28:13 -0400
committerWaylan Limberg <waylan@gmail.com>2009-05-13 15:28:13 -0400
commit45e4b6fe5ce80a04987a5dc688a986d8165bf354 (patch)
tree2d0fac68061755ea627570438755d78d34232c1d
parent6115ecc9185be643c6825fd4bd969edc4eff81ec (diff)
downloadmarkdown-45e4b6fe5ce80a04987a5dc688a986d8165bf354.tar.gz
markdown-45e4b6fe5ce80a04987a5dc688a986d8165bf354.tar.bz2
markdown-45e4b6fe5ce80a04987a5dc688a986d8165bf354.zip
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.
-rw-r--r--markdown/preprocessors.py17
1 files 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: