Difference between revisions of "Template:Teammates"

From QBWiki
Jump to navigation Jump to search
(Created page with "<includeonly>{{#vardefine:count|1}}{{#vardefine:nameindex|0}}{{#while: |{{{ {{#var:count}} |}}} |{{#ifeq:{{{ {{#var:count}} }}}|{{ROOTPAGENAME}}|{{#vardefine:nameindex|{{#var:...")
 
m
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
{{#vardefine:count|{{#expr:{{#var:count}}+1}}}}
 
{{#vardefine:count|{{#expr:{{#var:count}}+1}}}}
 
}}{{#vardefine:adjcount|{{#expr:{{#var:count}}-{{#ifexpr:{{#var:nameindex}}>0|1|0}}}}}}{{#ifeq:{{#var:adjcount}}|2
 
}}{{#vardefine:adjcount|{{#expr:{{#var:count}}-{{#ifexpr:{{#var:nameindex}}>0|1|0}}}}}}{{#ifeq:{{#var:adjcount}}|2
|{{{1}}}
+
|[[{{{1}}}]]
 
|{{#ifeq:{{#var:adjcount}}|3
 
|{{#ifeq:{{#var:adjcount}}|3
|{{{1}}} and {{{2}}}
+
|[[{{{1}}}]] and [[{{{2}}}]]
 
|{{#vardefine:i|1}}{{#while:
 
|{{#vardefine:i|1}}{{#while:
 
|{{#ifexpr:{{#var:i}}<{{#var:count}}|true}}
 
|{{#ifexpr:{{#var:i}}<{{#var:count}}|true}}
|{{#ifeq:{{#var:i}}|{{#var:nameindex}}||{{{ {{#var:i}} }}}{{#ifeq:{{#expr:{{#var:i}}+1+{{#ifexpr:{{#var:i}}>{{#var:nameindex}}|1|0}}}}|{{#var:count}}|<nowiki>, and </nowiki>|<nowiki>, </nowiki>}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
+
|{{#ifeq:{{#var:i}}|{{#var:nameindex}}||[[{{{ {{#var:i}} }}}]]{{#ifeq:{{#expr:{{#var:i}}+1+{{#ifexpr:{{#var:i}}>{{#var:nameindex}}|1|0}}}}|{{#var:count}}|<nowiki>, and </nowiki>|{{#ifexpr:{{#var:i}}+1<{{#var:count}}|<nowiki>, </nowiki>}}}}}}{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
}}
+
}}}}}}</includeonly><noinclude>
}}
+
For conveniently including repeating a list of teammates of, say, a nationals-winning team, on each member's player page. Automatically removes entries whose value matches the current page name.
}}
+
 
</includeonly><noinclude>
+
<pre>
{{Teammates|first1 last1|Teammates|first3 last3|first4 last4}}
+
Along with teammates
 +
{{Teammates|first1 last1|Teammates|first3 last3|first4 last4}}, "Teammates" won a fictional championship together.
 +
</pre>
 +
Along with teammates
 +
{{Teammates|first1 last1|Teammates|first3 last3|first4 last4}}, "Teammates" won a fictional championship together.
 
</noinclude>
 
</noinclude>

Latest revision as of 20:33, 2 April 2022

For conveniently including repeating a list of teammates of, say, a nationals-winning team, on each member's player page. Automatically removes entries whose value matches the current page name.

Along with teammates 
{{Teammates|first1 last1|Teammates|first3 last3|first4 last4}}, "Teammates" won a fictional championship together.

Along with teammates first1 last1, first3 last3, and first4 last4, "Teammates" won a fictional championship together.