diff options
| author | Asko Nõmm <asko@nmm.ee> | 2025-01-02 01:30:23 +0200 |
|---|---|---|
| committer | Asko Nõmm <asko@nmm.ee> | 2025-01-02 01:30:23 +0200 |
| commit | 689fe2613765de71101214a482c928cfdb1b2be6 (patch) | |
| tree | 53ff6f9a092caee32e5c600bccf5ee546bd8bc20 /htmtl/parsers/inner_text.py | |
| parent | 5e08a8b2f9258ae1f0aca7e3ad044b6360e07458 (diff) | |
Clean up some naming usages and things
Diffstat (limited to 'htmtl/parsers/inner_text.py')
| -rw-r--r-- | htmtl/parsers/inner_text.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/htmtl/parsers/inner_text.py b/htmtl/parsers/inner_text.py new file mode 100644 index 0000000..52fc0b4 --- /dev/null +++ b/htmtl/parsers/inner_text.py @@ -0,0 +1,13 @@ +from typing import Optional + +from dompa.nodes import Node, TextNode +from ..parser import Parser + + +class InnerText(Parser): + def traverse(self, node: Node) -> Optional[Node]: + if "inner-text" in node.attributes: + node.children = [TextNode(value=self.expression(node.attributes["inner-text"]))] + node.attributes.pop("inner-text") + + return node
\ No newline at end of file |
