summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--htmtl/attribute_parsers/inner_text.py8
-rw-r--r--htmtl/attribute_parsers/outer_text.py8
-rw-r--r--pyproject.toml2
3 files changed, 13 insertions, 5 deletions
diff --git a/htmtl/attribute_parsers/inner_text.py b/htmtl/attribute_parsers/inner_text.py
index 9195802..75ad01e 100644
--- a/htmtl/attribute_parsers/inner_text.py
+++ b/htmtl/attribute_parsers/inner_text.py
@@ -1,9 +1,13 @@
+from typing import Optional
+
from dompa.nodes import Node, TextNode
from ..attribute_parser import AttributeParser
class InnerText(AttributeParser):
- def traverse(self, node: Node):
+ 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") \ No newline at end of file
+ node.attributes.pop("inner-text")
+
+ return node \ No newline at end of file
diff --git a/htmtl/attribute_parsers/outer_text.py b/htmtl/attribute_parsers/outer_text.py
index 8d89b14..8e9bead 100644
--- a/htmtl/attribute_parsers/outer_text.py
+++ b/htmtl/attribute_parsers/outer_text.py
@@ -1,8 +1,12 @@
+from typing import Optional
+
from dompa.nodes import Node, TextNode
from ..attribute_parser import AttributeParser
class OuterText(AttributeParser):
- def traverse(self, node: Node):
+ def traverse(self, node: Node) -> Optional[Node]:
if "outer-text" in node.attributes:
- node.replace_with(TextNode(value=self.expression(node.attributes["outer-text"])))
+ return TextNode(value=self.expression(node.attributes["outer-text"]))
+
+ return node
diff --git a/pyproject.toml b/pyproject.toml
index 278a4b4..2fb9d8b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,7 @@ authors = [
{ name = "Asko Nõmm", email = "asko@nmm.ee" }
]
dependencies = [
- "dompa>0.3"
+ "dompa>0.4.1"
]
classifiers = [
"Programming Language :: Python :: 3",