Coverage for phml\compiler\steps\wrapper.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-04-06 14:03 -0500

1from phml.compiler.steps.base import comp_step 

2from phml.nodes import Element, Parent 

3 

4 

5@comp_step 

6def step_replace_phml_wrapper(node: Parent, *_): 

7 for child in list(node): 

8 if isinstance(child, Element) and child.tag in ["", "Template"]: 

9 idx = node.index(child) 

10 for c in child: 

11 if isinstance(c, Element): 

12 c.context.update(child.context) 

13 

14 del node[idx] 

15 node.insert(idx, child.children or [])