Preserve nested appearance style values
This commit is contained in:
@@ -63,6 +63,17 @@ def inspect_appearance_payload(data: bytes) -> dict[str, Any]:
|
||||
rule["value_type"] = value_type
|
||||
if value_node.attrib:
|
||||
rule["value_attributes"] = {key.rsplit("}", 1)[-1]: value for key, value in value_node.attrib.items()}
|
||||
nested_values = []
|
||||
for child in value_node.iter():
|
||||
if child is value_node or list(child):
|
||||
continue
|
||||
nested_values.append({
|
||||
"tag": _local_name(child.tag),
|
||||
"value": "".join(child.itertext()).strip(),
|
||||
**({"attributes": {key.rsplit("}", 1)[-1]: value for key, value in child.attrib.items()}} if child.attrib else {}),
|
||||
})
|
||||
if nested_values:
|
||||
rule["value_children"] = nested_values
|
||||
rules.append(rule)
|
||||
appearances.append({"ordinal": ordinal, "rules": rules})
|
||||
tag_counts = Counter(_local_name(node.tag) for node in root.iter())
|
||||
|
||||
Reference in New Issue
Block a user