summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2020-11-23 13:11:21 -0500
committerGitHub <noreply@github.com>2020-11-23 13:11:21 -0500
commit1279074ea97807c0131a2b82893189bc07bf2dd8 (patch)
treef4087381979070955d9c441390ee0e123c4f39e5 /tests
parent82ac9056350e67411cdb1da34363950b1e18a271 (diff)
downloadpython-markdown-1279074ea97807c0131a2b82893189bc07bf2dd8.tar.gz
Properly parse unclosed tags in code spans
* fix unclosed pi in code span * fix unclosed dec in code span * fix unclosed tag in code span Closes #1066.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_syntax/blocks/test_html_blocks.py105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/test_syntax/blocks/test_html_blocks.py b/tests/test_syntax/blocks/test_html_blocks.py
index 589f682..0fdb3e5 100644
--- a/tests/test_syntax/blocks/test_html_blocks.py
+++ b/tests/test_syntax/blocks/test_html_blocks.py
@@ -663,6 +663,48 @@ class TestHTMLBlocks(TestCase):
'<p>&lt;foo</p>'
)
+ def test_raw_unclosed_tag_in_code_span(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ `<div`.
+
+ <div>
+ hello
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <p><code>&lt;div</code>.</p>
+ <div>
+ hello
+ </div>
+ """
+ )
+ )
+
+ def test_raw_unclosed_tag_in_code_span_space(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ` <div `.
+
+ <div>
+ hello
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <p><code>&lt;div</code>.</p>
+ <div>
+ hello
+ </div>
+ """
+ )
+ )
+
def test_raw_attributes(self):
self.assertMarkdownRenders(
'<p id="foo", class="bar baz", style="margin: 15px; line-height: 1.5; text-align: center;">text</p>',
@@ -1073,6 +1115,27 @@ class TestHTMLBlocks(TestCase):
)
)
+ def test_raw_processing_instruction_code_span(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ `<?php`
+
+ <div>
+ foo
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <p><code>&lt;?php</code></p>
+ <div>
+ foo
+ </div>
+ """
+ )
+ )
+
def test_raw_declaration_one_line(self):
self.assertMarkdownRenders(
'<!DOCTYPE html>',
@@ -1110,6 +1173,27 @@ class TestHTMLBlocks(TestCase):
)
)
+ def test_raw_declaration_code_span(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ `<!`
+
+ <div>
+ foo
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <p><code>&lt;!</code></p>
+ <div>
+ foo
+ </div>
+ """
+ )
+ )
+
def test_raw_cdata_one_line(self):
self.assertMarkdownRenders(
'<![CDATA[ document.write(">"); ]]>',
@@ -1190,6 +1274,27 @@ class TestHTMLBlocks(TestCase):
)
)
+ def test_raw_cdata_code_span(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ `<![`
+
+ <div>
+ foo
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <p><code>&lt;![</code></p>
+ <div>
+ foo
+ </div>
+ """
+ )
+ )
+
def test_charref(self):
self.assertMarkdownRenders(
'&sect;',