Difference between revisions of "Template:Tree"
| Line 10: | Line 10: | ||
| {{Tree/Children|{{{2|, }}}|| | | {{Tree/Children|{{{2|, }}}|| | ||
| current parent={{{1}}} | | current parent={{{1}}} | ||
| − | | current child={{{{{children}}}|{{{1}}}|1}} | + | | current child={{{{{children}}}|{{{1}}}| depth=1 | index=1 }} |
| depth=1 | | depth=1 | ||
| index=1 | | index=1 | ||
Revision as of 06:27, 18 June 2015
Apply a template to a string, and then recursively apply this template to each "child", as defined by a function.
- First parameter: Root of the tree
- Second parameter: Delimiter used to separate each application of the template; default is comma+space
- 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; depth and index are the tree coordinates of the child, 1-based; empty result indicates no more children)
- skip root: Whether the root of the tree should be skipped; if so, the root's children have depth 1