mirror of
https://github.com/vale981/recommonmark
synced 2025-03-05 10:01:39 -05:00
commit
298caf6462
2 changed files with 28 additions and 2 deletions
|
@ -218,13 +218,19 @@ class CommonMarkParser(parsers.Parser):
|
||||||
self.current_node.append(q)
|
self.current_node.append(q)
|
||||||
self.current_node = q
|
self.current_node = q
|
||||||
|
|
||||||
def visit_html_inline(self, mdnode):
|
def visit_html(self, mdnode):
|
||||||
raw_node = nodes.raw(mdnode.literal,
|
raw_node = nodes.raw(mdnode.literal,
|
||||||
mdnode.literal, format='html')
|
mdnode.literal, format='html')
|
||||||
if mdnode.sourcepos is not None:
|
if mdnode.sourcepos is not None:
|
||||||
raw_node.line = mdnode.sourcepos[0][0]
|
raw_node.line = mdnode.sourcepos[0][0]
|
||||||
self.current_node.append(raw_node)
|
self.current_node.append(raw_node)
|
||||||
|
|
||||||
|
def visit_html_inline(self, mdnode):
|
||||||
|
self.visit_html(mdnode)
|
||||||
|
|
||||||
|
def visit_html_block(self, mdnode):
|
||||||
|
self.visit_html(mdnode)
|
||||||
|
|
||||||
def visit_thematic_break(self, _):
|
def visit_thematic_break(self, _):
|
||||||
self.current_node.append(nodes.transition())
|
self.current_node.append(nodes.transition())
|
||||||
|
|
||||||
|
|
|
@ -403,7 +403,7 @@ class TestParsing(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_html(self):
|
def test_html_inline(self):
|
||||||
self.assertParses(
|
self.assertParses(
|
||||||
"""
|
"""
|
||||||
Foo
|
Foo
|
||||||
|
@ -423,6 +423,26 @@ class TestParsing(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_html_block(self):
|
||||||
|
self.assertParses(
|
||||||
|
"""
|
||||||
|
Foo
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<blink>Blink</blink>
|
||||||
|
</div>
|
||||||
|
""",
|
||||||
|
"""
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<document source="<string>">
|
||||||
|
<paragraph>Foo</paragraph>
|
||||||
|
<raw format="html" xml:space="preserve"><div>
|
||||||
|
<blink>Blink</blink>
|
||||||
|
</div></raw>
|
||||||
|
</document>
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
def test_eval(self):
|
def test_eval(self):
|
||||||
self.assertParses(
|
self.assertParses(
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue