diff options
| author | Asko Nõmm <asko@nmm.ee> | 2024-12-30 18:51:58 +0200 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2024-12-30 18:51:58 +0200 |
| commit | 1ac6564a775835dd9bc93a2fb48ef87f9fc2daed (patch) | |
| tree | 68bc998db7dd5d1b203671822273283eb6b6176a /htmtl/attribute_parsers | |
| parent | 69968c9e34ae57cfee905d94fc98ec6a83fbe92b (diff) | |
bump
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 |
