Difference between revisions of "Template:ListEdges"

From AtlasWiki
Jump to: navigation, search
(Moving the parent separator to reduce/avoid empty rows)
(removing the trailing empty line from the tables)
 
Line 41: Line 41:
 
 
 
We gather the information on inherited edges as well, then defer to a helper template to print the actual tables
 
We gather the information on inherited edges as well, then defer to a helper template to print the actual tables
 +
 +
There's one tricky bit here: we need to have a <PARENT_SEP> separator if and only if a parent actually contributes connections. We do that by not using the separator argument of the #arrayprint:parentsArray, and instead printing <PARENT_SEP> after each one...which results in one small problem: there's an extra <PARENT_SEP> on the end that we need to remove...so we parse the result into an array again, slice off the final element with #arrayslice, and re-print it using <PARENT_SEP> as the separator.
 
 
 
--></noinclude>{{ListEdges.generateTable
 
--></noinclude>{{ListEdges.generateTable
Line 47: Line 49:
 
| nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr>
 
| nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr>
 
| uninheritedEdges = {{#arrayprint:specifiedInEdges|<EDGE_SEP>}}
 
| uninheritedEdges = {{#arrayprint:specifiedInEdges|<EDGE_SEP>}}
| inheritedEdges = {{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesTo|@@@@|specified}}|@@@@<PARENT>{{EdgesTo|@@@@|specified}}<PARENT_SEP>}} }}
+
| inheritedEdges = {{#arraydefine:temp|{{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesTo|@@@@|specified}}|@@@@<PARENT>{{EdgesTo|@@@@|specified}}<PARENT_SEP>}} }}|<PARENT_SEP>|}}{{#arrayslice:temp|temp|0|{{#expr:{{#arraysize:temp}}-1}}}}{{#arrayprint:temp|<PARENT_SEP>|@@@@|@@@@}}
 
}}{{ListEdges.generateTable
 
}}{{ListEdges.generateTable
 
| title = Specified Out Edges
 
| title = Specified Out Edges
Line 53: Line 55:
 
| nodeTitle = <abbr title="The node that the edge points to">Successor</abbr>
 
| nodeTitle = <abbr title="The node that the edge points to">Successor</abbr>
 
| uninheritedEdges = {{#arrayprint:specifiedOutEdges|<EDGE_SEP>}}
 
| uninheritedEdges = {{#arrayprint:specifiedOutEdges|<EDGE_SEP>}}
| inheritedEdges = {{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesFrom|@@@@|specified}}|@@@@<PARENT>{{EdgesFrom|@@@@|specified}}<PARENT_SEP>}} }}
+
| inheritedEdges = {{#arraydefine:temp|{{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesFrom|@@@@|specified}}|@@@@<PARENT>{{EdgesFrom|@@@@|specified}}<PARENT_SEP>}} }}|<PARENT_SEP>|}}{{#arrayslice:temp|temp|0|{{#expr:{{#arraysize:temp}}-1}}}}{{#arrayprint:temp|<PARENT_SEP>|@@@@|@@@@}}
 
}}{{ListEdges.generateTable
 
}}{{ListEdges.generateTable
 
| title = Known Possible In Edges
 
| title = Known Possible In Edges
Line 59: Line 61:
 
| nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr>
 
| nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr>
 
| uninheritedEdges = {{#arrayprint:permittedInEdges|<EDGE_SEP>}}
 
| uninheritedEdges = {{#arrayprint:permittedInEdges|<EDGE_SEP>}}
| inheritedEdges = {{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesTo|@@@@|permitted}}|@@@@<PARENT>{{EdgesTo|@@@@|permitted}}<PARENT_SEP>}} }}
+
| inheritedEdges = {{#arraydefine:temp|{{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesTo|@@@@|permitted}}|@@@@<PARENT>{{EdgesTo|@@@@|permitted}}<PARENT_SEP>}} }}|<PARENT_SEP>|}}{{#arrayslice:temp|temp|0|{{#expr:{{#arraysize:temp}}-1}}}}{{#arrayprint:temp|<PARENT_SEP>|@@@@|@@@@}}
 
}}{{ListEdges.generateTable
 
}}{{ListEdges.generateTable
 
| title = Known Possible Out Edges
 
| title = Known Possible Out Edges
Line 65: Line 67:
 
| nodeTitle = <abbr title="The node that the edge points to">Successor</abbr>
 
| nodeTitle = <abbr title="The node that the edge points to">Successor</abbr>
 
| uninheritedEdges = {{#arrayprint:permittedOutEdges|<EDGE_SEP>}}
 
| uninheritedEdges = {{#arrayprint:permittedOutEdges|<EDGE_SEP>}}
| inheritedEdges = {{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesFrom|@@@@|permitted}}|@@@@<PARENT>{{EdgesFrom|@@@@|permitted}}<PARENT_SEP>}} }}
+
| inheritedEdges = {{#arraydefine:temp|{{#arrayprint:parentsArray||@@@@|{{#if:{{EdgesFrom|@@@@|permitted}}|@@@@<PARENT>{{EdgesFrom|@@@@|permitted}}<PARENT_SEP>}} }}|<PARENT_SEP>|}}{{#arrayslice:temp|temp|0|{{#expr:{{#arraysize:temp}}-1}}}}{{#arrayprint:temp|<PARENT_SEP>|@@@@|@@@@}}
 
}}
 
}}

Latest revision as of 14:03, 12 May 2014

For use on node kind pages, automatically lists edges declared on the current page.

If the parameter "parents" is given a comma-separated list of the parents of the node, inherited edges will also be listed.