Difference between revisions of "Template:Activehs"

From QBWiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if:{{{2|}}}
+
<includeonly>{{#if:{{{1|}}}|{{#if:{{{2|}}}|{{#vardefine:i|{{{1}}}}}{{#while:
<!----->|{{#iferror:{{#expr:{{{2}}}-{{{1}}}}}
+
|{{#ifexpr:{{#var:i}}<={{{2}}}|true}}
<!-----><!----->|{{#switch:{{#expr:{{{2}}}-{{{1}}}}}
+
|[[Category: High school players active in {{#var:i}}]]{{#vardefine:i|{{#expr:{{#var:i}}+1}}}}
<!-----><!-----><!----->|1=[[Category:High school players active in {{{1}}}]]
+
}}|[[Category: High school players active in {{{1}}}]]}}}}
<!-----><!-----><!----->[[Category:High school players active in {{{2}}}]]
+
</includeonly><noinclude>Shorthand for adding active years for high school players.
<!-----><!-----><!----->|2=[[Category:High school players active in {{{1}}}]]
 
<!-----><!-----><!----->[[Category:High school players active in {{#expr:{{{1}}}+1}}]]
 
<!-----><!-----><!----->[[Category:High school players active in {{{2}}}]]
 
<!-----><!-----><!----->|3=[[Category:High school players active in {{{1}}}]]
 
<!-----><!-----><!----->[[Category:High school players active in {{#expr:{{{1}}}+1}}]]
 
<!-----><!-----><!----->[[Category:High school players active in {{#expr:{{{1}}}+2}}]]
 
<!-----><!-----><!----->[[Category:High school players active in {{{2}}}]]
 
<!-----><!-----><!----->|#default=[[Category:High school players active in {{{1}}}]]
 
<!-----><!----->}}|Error in the input}}
 
<!----->|[[Category:High school players active in {{{1}}}]]
 
}}</includeonly><noinclude>Shorthand for adding active years for high school player.
 
  
 
*{{{1}}} - start year (inclusive)
 
*{{{1}}} - start year (inclusive)
 
*{{{2}}} - end year (inclusive; optional)
 
*{{{2}}} - end year (inclusive; optional)
  
<nowiki>{{activehs|2005|2009}}</nowiki></noinclude>
+
The end year can be an arbitrary number of years after the start year, thanks to a loop.
 +
 
 +
===Usage:===
 +
{| class="wikitable"
 +
! input
 +
! output
 +
|-
 +
|<nowiki>{{activehs|2005}}</nowiki> || <nowiki>[[Category: High school players active in 2005]]</nowiki>
 +
|-
 +
|<nowiki>{{activehs|2005|2005}}</nowiki> || <nowiki>[[Category: High school players active in 2005]]</nowiki>
 +
|-
 +
|<nowiki>{{activehs|2005|2004}}</nowiki> ||
 +
|-
 +
|<nowiki>{{activehs|2005|2006}}</nowiki> || <nowiki>[[Category: High school players active in 2005]]
 +
[[Category: High school players active in 2006]]</nowiki>
 +
|-
 +
|<nowiki>{{activehs|2005|2007}}</nowiki> || <nowiki>[[Category: High school players active in 2005]]
 +
[[Category: High school players active in 2006]]
 +
[[Category: High school players active in 2007]]</nowiki>
 +
|-
 +
|<nowiki>{{activehs|2005|2008}}</nowiki> || <nowiki>[[Category: High school players active in 2005]]
 +
[[Category: High school players active in 2006]]
 +
[[Category: High school players active in 2007]]
 +
[[Category: High school players active in 2008]]</nowiki>
 +
|}</noinclude>

Latest revision as of 08:05, 25 October 2021

Shorthand for adding active years for high school players.

  • {{{1}}} - start year (inclusive)
  • {{{2}}} - end year (inclusive; optional)

The end year can be an arbitrary number of years after the start year, thanks to a loop.

Usage:

input output
{{activehs|2005}} [[Category: High school players active in 2005]]
{{activehs|2005|2005}} [[Category: High school players active in 2005]]
{{activehs|2005|2004}}
{{activehs|2005|2006}} [[Category: High school players active in 2005]] [[Category: High school players active in 2006]]
{{activehs|2005|2007}} [[Category: High school players active in 2005]] [[Category: High school players active in 2006]] [[Category: High school players active in 2007]]
{{activehs|2005|2008}} [[Category: High school players active in 2005]] [[Category: High school players active in 2006]] [[Category: High school players active in 2007]] [[Category: High school players active in 2008]]