summaryrefslogtreecommitdiff
path: root/htmtl/attribute_parsers
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2024-12-30 20:24:23 +0200
committerAsko Nõmm <asko@nmm.ee>2024-12-30 20:24:23 +0200
commit1017edd34bff48fee7362e48838d94e8fd11bdad (patch)
tree9bf882c7d520676f429d48370ae9da383ddc24ab /htmtl/attribute_parsers
parent1ac6564a775835dd9bc93a2fb48ef87f9fc2daed (diff)
bump
Diffstat (limited to 'htmtl/attribute_parsers')
-rw-r--r--htmtl/attribute_parsers/inner_text.py4
-rw-r--r--htmtl/attribute_parsers/outer_text.py8
2 files changed, 10 insertions, 2 deletions
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"])))