diff options
Diffstat (limited to 'htmtl/attribute_parsers')
| -rw-r--r-- | htmtl/attribute_parsers/__init__.py | 1 | ||||
| -rw-r--r-- | htmtl/attribute_parsers/inner_text.py | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/htmtl/attribute_parsers/__init__.py b/htmtl/attribute_parsers/__init__.py index e69de29..d05c6db 100644 --- a/htmtl/attribute_parsers/__init__.py +++ b/htmtl/attribute_parsers/__init__.py @@ -0,0 +1 @@ +from .inner_text import InnerText
\ No newline at end of file diff --git a/htmtl/attribute_parsers/inner_text.py b/htmtl/attribute_parsers/inner_text.py new file mode 100644 index 0000000..bd98010 --- /dev/null +++ b/htmtl/attribute_parsers/inner_text.py @@ -0,0 +1,9 @@ +from dompa.nodes import Node, TextNode +from htmtl.attribute_parser import AttributeParser + + +class InnerText(AttributeParser): + def traverse(self, node: Node): + if "inner-text" in node.attributes: + node.children = [TextNode(self.expression(node.attributes["inner-text"]))] + node.attributes.pop("inner-text")
\ No newline at end of file |
