blob: 87b0d63a19328bfd904f09a28fb4a0bc2e0f0554 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
from typing import Optional
from dompa.nodes import Node
from ..parser import Parser
class GenericValue(Parser):
def traverse(self, node: Node) -> Optional[Node]:
new_attrs = {}
for key, val in node.attributes.items():
if key.startswith(":"):
new_attrs[key[1:]] = self.expression(val)
else:
new_attrs[key] = val
node.attributes = new_attrs
return node
|