summaryrefslogtreecommitdiff
path: root/htmtl/parsers/when_not.py
blob: 96383b7d2c8953cbb73642833309be1ca88ec30e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from typing import Optional
from dompa.nodes import Node
from ..parser import Parser


class WhenNot(Parser):
    def traverse(self, node: Node) -> Optional[Node]:
        if "when-not" in node.attributes:
            if self.parse_expression(node.attributes["when-not"]):
                return None

            node.attributes.pop("when-not")

        return node