Difference between revisions of "Template:Tree/Subtree"
(Created page with "<noinclude>Apply a template to a string, and then recursively apply this function to each "child", as defined by a function. * First parameter: Delimiter to prefix future node...") |
|||
| Line 5: | Line 5: | ||
* ''depth'': Depth of parent | * ''depth'': Depth of parent | ||
* ''index'': i, where parent is the ith child of its parent | * ''index'': i, where parent is the ith child of its parent | ||
| − | * ''template'': Template to apply to each node (first parameter is the node; ''depth'' | + | * ''template'': Template to apply to each node (first parameter is the node; ''depth'' and ''index'' are the tree coordinates, 1-based) |
| − | * ''children'': Function mapping a parent to children (first parameter is the node; second parameter is the requested index, 1-based; empty indicates no more children) | + | * ''children'': Function mapping a parent to children (first parameter is the node; second parameter is the requested index, 1-based; empty result indicates no more children) |
</noinclude><includeonly>{{Wrap|{{{2}}}|{{{{{template}}}|{{{current parent}}}| | </noinclude><includeonly>{{Wrap|{{{2}}}|{{{{{template}}}|{{{current parent}}}| | ||
depth={{{depth}}} | depth={{{depth}}} | ||
Revision as of 21:43, 15 June 2015
Apply a template to a string, and then recursively apply this function to each "child", as defined by a function.
- First parameter: Delimiter to prefix future nodes
- Second parameter: Current delimiter to prefix parent
- current parent: Parent of this subtree
- depth: Depth of parent
- index: i, where parent is the ith child of its parent
- template: Template to apply to each node (first parameter is the node; depth and index are the tree coordinates, 1-based)
- children: Function mapping a parent to children (first parameter is the node; second parameter is the requested index, 1-based; empty result indicates no more children)