From 1017edd34bff48fee7362e48838d94e8fd11bdad Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Mon, 30 Dec 2024 20:24:23 +0200 Subject: bump --- htmtl/attribute_parsers/inner_text.py | 4 ++-- htmtl/attribute_parsers/outer_text.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 htmtl/attribute_parsers/outer_text.py (limited to 'htmtl/attribute_parsers') diff --git a/htmtl/attribute_parsers/inner_text.py b/htmtl/attribute_parsers/inner_text.py index bd98010..9195802 100644 --- a/htmtl/attribute_parsers/inner_text.py +++ b/htmtl/attribute_parsers/inner_text.py @@ -1,9 +1,9 @@ from dompa.nodes import Node, TextNode -from htmtl.attribute_parser import AttributeParser +from ..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.children = [TextNode(value=self.expression(node.attributes["inner-text"]))] node.attributes.pop("inner-text") \ No newline at end of file diff --git a/htmtl/attribute_parsers/outer_text.py b/htmtl/attribute_parsers/outer_text.py new file mode 100644 index 0000000..8d89b14 --- /dev/null +++ b/htmtl/attribute_parsers/outer_text.py @@ -0,0 +1,8 @@ +from dompa.nodes import Node, TextNode +from ..attribute_parser import AttributeParser + + +class OuterText(AttributeParser): + def traverse(self, node: Node): + if "outer-text" in node.attributes: + node.replace_with(TextNode(value=self.expression(node.attributes["outer-text"]))) -- cgit v1.2.3