feat: add support of internal children

This commit is contained in:
Gleb Smirnov 2022-01-22 09:42:49 +03:00
parent 1bd7c37061
commit 8a545d596b
No known key found for this signature in database
GPG key ID: 559DB6D1D625EFAB
3 changed files with 10 additions and 2 deletions

View file

@ -195,7 +195,12 @@ class Template(Object):
class Child(AstNode):
def emit_xml(self, xml: XmlEmitter):
xml.start_tag("child", type=self.tokens["child_type"])
child_type = internal_child = None
if self.tokens["internal_child"]:
internal_child = self.tokens["child_type"]
else:
child_type = self.tokens["child_type"]
xml.start_tag("child", type=child_type, internal_child=internal_child)
for child in self.children:
child.emit_xml(xml)
xml.end_tag()