diff options
author | Waylan Limberg <waylan@gmail.com> | 2011-12-30 06:31:32 +0800 |
---|---|---|
committer | Mike Dirolf <mike@dirolf.com> | 2012-01-15 00:45:37 +0800 |
commit | 5d177e635c4c0c5ce2db636ba395d0d9b715892d (patch) | |
tree | 2762de828a159f7de31f22f8d4ac0e228137a836 /markdown/preprocessors.py | |
parent | 44caa3aaa1022532f3ecdada6cff7fe5fd0a2c44 (diff) | |
download | markdown-5d177e635c4c0c5ce2db636ba395d0d9b715892d.tar.gz markdown-5d177e635c4c0c5ce2db636ba395d0d9b715892d.tar.bz2 markdown-5d177e635c4c0c5ce2db636ba395d0d9b715892d.zip |
Fixed #68. Blank line is not required after html comments.
Interestingly, the change to the misc/mismatched-tags test is inline with
PHP Markdown Extra's behavior but not markdown.pl, which produces invalid html.
Diffstat (limited to 'markdown/preprocessors.py')
-rw-r--r-- | markdown/preprocessors.py | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index a80f9fb..0094d7b 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -143,21 +143,20 @@ class HtmlBlockPreprocessor(Preprocessor): if not in_tag: if block.startswith("<") and len(block.strip()) > 1: - left_tag, left_index, attrs = self._get_left_tag(block) - right_tag, data_index = self._get_right_tag(left_tag, - left_index, - block) if block[1] == "!": # is a comment block - left_tag = "--" - right_tag, data_index = self._get_right_tag(left_tag, - left_index, - block) - # keep checking conditions below and maybe just append + left_tag, left_index, attrs = "--", 2, () + else: + left_tag, left_index, attrs = self._get_left_tag(block) + right_tag, data_index = self._get_right_tag(left_tag, + left_index, + block) + # keep checking conditions below and maybe just append if data_index < len(block) \ - and util.isBlockLevel(left_tag): + and (util.isBlockLevel(left_tag) + or left_tag == '--'): text.insert(0, block[data_index:]) block = block[:data_index] @@ -202,12 +201,9 @@ 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, - 0, - block) + right_tag, data_index = self._get_right_tag(left_tag, 0, block) if self._equal_tags(left_tag, right_tag): # if find closing tag |