In certain cases it's useful to utilize partials (see mustache specification).
You can define partials in separate .mustache files
group-tree.mustache
{{Name}}
{{#Groups}}{{>group-tree}}{{/Groups}}
and reference them by file name in your template definition
{{#PLCs}}
{{#Software.TechnologicalObjectGroup}}
// traverse recursive over groups
{{>group-tree}}
{{/Software.TechnologicalObjectGroup}}
{{/PLCs}}
or define your partials directly in the template file as a key-value map separated by a colon. Each line that starts with a key followed by a colon is a template. For multiline templates, you can use the file approach.
{{#partials}}
// map TO types to AX classes
TO_SpeedAxis : SpeedAxis
TO_PositioningAxis : PosAxis
TO_SynchronousAxis : SyncAxis{{#IsTechnologyCPU}}Advanced{{/IsTechnologyCPU}}
...
{{/partials}}
{{#PLCs}}
{{#Software.TechnologicalObjectGroup}}
{{#TechnologicalObjects}}
{{Name}}_Instance : {{>*Type}}; // map type by dynamic partials.
{{/TechnologicalObjects}}
{{/Software.TechnologicalObjectGroup}}
{{/PLCs}}
The example above shows support for dynamic partials. You can define dynamic names for partials using an asterisk {{>*Type}}. This enables a mapping of TIA project data to corresponding AX entities.
Additionally you can define multiple mappings for the same data by extending the partial name with the + sign.
{{#partials}}
// map TO types to AX classes
TO_SpeedAxis : SpeedAxis
TO_Cam : Cam
...
// map TO types to AX interfaces
TO_SpeedAxis+itf : itfSpeedAxis
TO_Cam+itf : itfCamBase
...
{{/partials}}
{{#PLCs}}
{{#Software.TechnologicalObjectGroup}}
{{#TechnologicalObjects}}
{{Name}}_Instance : {{>*Type}}; // instanciate class.
{{Name}} : {{>*Type+itf}}; // declare interface.
{{/TechnologicalObjects}}
{{/Software.TechnologicalObjectGroup}}
{{/PLCs}}