summaryrefslogtreecommitdiff
path: root/tests/test_syntax
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2020-11-19 14:42:24 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2020-11-19 14:51:57 -0500
commit82ac9056350e67411cdb1da34363950b1e18a271 (patch)
tree476c15c673ffe3a92700dcc9f96e41f586f1d4dc /tests/test_syntax
parent81cc5b8bf1ad2a44b0a042d059caab3ed802ed33 (diff)
downloadpython-markdown-82ac9056350e67411cdb1da34363950b1e18a271.tar.gz
Properly parse processing instructions in md_in_html
Empty tags do not have a `mardkown` attribute set on them. Therefore, there is no need to check the mdstack to determine behavior. If we are in any md_in_html state (regardless of block, span, etc) the behavior is the same. Fixes #1070.
Diffstat (limited to 'tests/test_syntax')
-rw-r--r--tests/test_syntax/extensions/test_md_in_html.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test_syntax/extensions/test_md_in_html.py b/tests/test_syntax/extensions/test_md_in_html.py
index 7786b80..8655607 100644
--- a/tests/test_syntax/extensions/test_md_in_html.py
+++ b/tests/test_syntax/extensions/test_md_in_html.py
@@ -634,6 +634,56 @@ class TestMdInHTML(TestCase):
)
)
+ def test_md1_PI_oneliner(self):
+ self.assertMarkdownRenders(
+ '<div markdown="1"><?php print("foo"); ?></div>',
+ self.dedent(
+ """
+ <div>
+ <?php print("foo"); ?>
+ </div>
+ """
+ )
+ )
+
+ def test_md1_PI_multiline(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ <div markdown="1">
+ <?php print("foo"); ?>
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <div>
+ <?php print("foo"); ?>
+ </div>
+ """
+ )
+ )
+
+ def test_md1_PI_blank_lines(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ <div markdown="1">
+
+ <?php print("foo"); ?>
+
+ </div>
+ """
+ ),
+ self.dedent(
+ """
+ <div>
+ <?php print("foo"); ?>
+ </div>
+ """
+ )
+ )
+
def test_md_span_paragraph(self):
self.assertMarkdownRenders(
'<p markdown="span">*foo*</p>',