diff options
Diffstat (limited to 'htmtl/parsers/inner_html.py')
| -rw-r--r-- | htmtl/parsers/inner_html.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/htmtl/parsers/inner_html.py b/htmtl/parsers/inner_html.py new file mode 100644 index 0000000..60e90ca --- /dev/null +++ b/htmtl/parsers/inner_html.py @@ -0,0 +1,16 @@ +from typing import Optional + +from dompa import Dompa +from dompa.nodes import Node + +from ..parser import Parser + + +class InnerHtml(Parser): + def traverse(self, node: Node) -> Optional[Node]: + if "inner-html" in node.attributes: + child_nodes = Dompa(self.expression(node.attributes["inner-html"])).nodes() + node.children = child_nodes + node.attributes.pop("inner-html") + + return node
\ No newline at end of file |
