Difference between revisions of "Template:ListEdges"
From AtlasWiki
(adding newlines) |
(Switching to permitted and specified edges, instead of just one class of edge relationships) |
||
Line 2: | Line 2: | ||
If the parameter "parents" is given a comma-separated list of the parents of the node, inherited edges will also be listed. | If the parameter "parents" is given a comma-separated list of the parents of the node, inherited edges will also be listed. | ||
− | </noinclude>{{#ask: [[edge to {{PAGENAME}}::+]] | + | </noinclude>{{#ask: [[permitted edge to {{PAGENAME}}::+]] |
− | | ?edge to {{PAGENAME}} | + | | ?permitted edge to {{PAGENAME}} |
| format=array | | format=array | ||
| headers=hide | | headers=hide | ||
− | | name= | + | | name=permittedInEdges |
+ | }}{{#ask: [[specified edge to {{PAGENAME}}::+]] | ||
+ | | ?specified edge to {{PAGENAME}} | ||
+ | | format=array | ||
+ | | headers=hide | ||
+ | | name=specifiedInEdges | ||
+ | }}{{#ask: [[permitted edge from {{PAGENAME}}::+]] | ||
+ | | ?permitted edge from {{PAGENAME}} | ||
+ | | format=array | ||
+ | | headers=hide | ||
+ | | name=permittedOutEdges | ||
+ | }}{{#ask: [[specified edge from {{PAGENAME}}::+]] | ||
+ | | ?specified edge from {{PAGENAME}} | ||
+ | | format=array | ||
+ | | headers=hide | ||
+ | | name=specifiedOutEdges | ||
}}<noinclude><!-- | }}<noinclude><!-- | ||
− | Above, we've stored all the in edges in an | + | Above, we've stored all the in edges in an arrays named "permittedInEdges", "specifiedInEdges", "permittedOutEdges", and "specifiedOutEdges". |
− | Each entry in | + | Each entry in each array is in this format: |
[name of edge]<PROP>[name of predecessor]$SEP$[multiplicity]$SEP$[edge description] | [name of edge]<PROP>[name of predecessor]$SEP$[multiplicity]$SEP$[edge description] | ||
Line 21: | Line 36: | ||
[name of edge]<PROP>[name of predecessor]$SEP$[multiplicity]$SEP$[edge description]<MANY>[name of other predecessor]$SEP$[multiplicity] | [name of edge]<PROP>[name of predecessor]$SEP$[multiplicity]$SEP$[edge description]<MANY>[name of other predecessor]$SEP$[multiplicity] | ||
− | ...now we | + | ...now we want similar information about inherited in edges: |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | --></noinclude>{{# | + | --></noinclude>{{#arraydefine:parentsArray|{{{parents|}}}|,|}}<noinclude><!-- |
− | {{{ | + | |
− | {{ | + | We gather the information on inherited edges as well, then defer to a helper template to print the actual tables |
− | + | ||
− | {{ | + | --></noinclude>{{ListEdges.generateTable |
− | + | | title = Specified In Edges | |
− | {{#arrayprint: | + | | edgeTitle = In Edge |
− | {{ | + | | nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr> |
− | {{ | + | | uninheritedEdges = {{#arrayprint:specifiedInEdges|<EDGE_SEP>}} |
+ | | inheritedEdges = {{#arrayprint:parentsArray|<PARENT_SEP>|@@@@|{{#if:{{EdgesTo|@@@@|specified}}|@@@@<PARENT>{{EdgesTo|@@@@|specified}} }} }} | ||
+ | }}{{ListEdges.generateTable | ||
+ | | title = Specified Out Edges | ||
+ | | edgeTitle = Out Edge | ||
+ | | nodeTitle = <abbr title="The node that the edge points to">Successor</abbr> | ||
+ | | uninheritedEdges = {{#arrayprint:specifiedOutEdges|<EDGE_SEP>}} | ||
+ | | inheritedEdges = {{#arrayprint:parentsArray|<PARENT_SEP>|@@@@|{{#if:{{EdgesFrom|@@@@|specified}}|@@@@<PARENT>{{EdgesFrom|@@@@|specified}} }} }} | ||
+ | }}{{ListEdges.generateTable | ||
+ | | title = Known Possible In Edges | ||
+ | | edgeTitle = In Edge | ||
+ | | nodeTitle = <abbr title="The node that the edge comes from">Predecessor</abbr> | ||
+ | | uninheritedEdges = {{#arrayprint:permittedInEdges|<EDGE_SEP>}} | ||
+ | | inheritedEdges = {{#arrayprint:parentsArray|<PARENT_SEP>|@@@@|{{#if:{{EdgesTo|@@@@|permitted}}|@@@@<PARENT>{{EdgesTo|@@@@|permitted}} }} }} | ||
+ | }}{{ListEdges.generateTable | ||
+ | | title = Known Possible Out Edges | ||
+ | | edgeTitle = Out Edge | ||
+ | | nodeTitle = <abbr title="The node that the edge points to">Successor</abbr> | ||
+ | | uninheritedEdges = {{#arrayprint:permittedOutEdges|<EDGE_SEP>}} | ||
+ | | inheritedEdges = {{#arrayprint:parentsArray|<PARENT_SEP>|@@@@|{{#if:{{EdgesFrom|@@@@|permitted}}|@@@@<PARENT>{{EdgesFrom|@@@@|permitted}} }} }} | ||
+ | }} |
Revision as of 13:28, 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.