Difference between revisions of "Template:NASAT results by state by year"
Jump to navigation
Jump to search
Kevin Wang (talk | contribs) |
Kevin Wang (talk | contribs) |
||
Line 2: | Line 2: | ||
clear variables | clear variables | ||
-->{{#loop:k|1|55|{{#vardefine:p{{#var:k}}|}}}}<!-- | -->{{#loop:k|1|55|{{#vardefine:p{{#var:k}}|}}}}<!-- | ||
− | + | -->{{#vardefine:max|0}}<!-- | |
− | -->{{#if:{{#var: | + | -->{{#if:{{{raw|}}}<!-- |
− | loop through the list of states + DC | + | case 1: handle raw string |
− | -->{{#vardefine: | + | --><!---->|{{#vardefine:n|0}}{{#while:<!-- |
− | -->{{#if:{{#var:p{{{ {{#var: | + | --><!----><!---->|{{#explode:{{{raw}}}|,|{{#var:n}}}}<!-- |
− | -->}}}}<includeonly> | + | --><!----><!---->|{{#vardefine:line|{{#explode:{{{raw}}}|,|{{#var:n}}}}}}<!-- |
+ | --><!----><!---->{{#vardefine:placement|{{#explode:{{#var:line}}|=|1}}}}<!-- | ||
+ | --><!----><!---->{{#ifexpr:{{#var:placement}}>{{#var:max}}|{{#vardefine:max|{{#var:placement}}}}}}<!-- | ||
+ | check if placement already defined | ||
+ | --><!----><!---->{{#if:{{#var:p{{#var:placement}}}}<!-- | ||
+ | --><!----><!----><!---->|{{#vardefine:p{{#var:placement}}|{{#var:p{{#var:placement}}}},{{#explode:{{#var:line}}|=|0}}}}<!-- | ||
+ | --><!----><!----><!---->|{{#vardefine:p{{#var:placement}}|{{#explode:{{#var:line}}|=|0}}}}<!-- | ||
+ | --><!----><!---->}}{{#vardefine:n|{{#expr:{{#var:n}}+1}}}}<!-- | ||
+ | --><!---->}}<!-- | ||
+ | case 2: loop through the arguments using a pre-defined list of states + DC | ||
+ | --><!---->|{{#if:{{#var:uses}}<!-- | ||
+ | --><!----><!---->|{{#vardefine:uses|{{#expr:{{#var:uses}}+1}}}}<!-- | ||
+ | --><!----><!---->|{{#vardefine:uses|1}}<!-- | ||
+ | --><!---->}}<!-- | ||
+ | --><!---->{{#loop:i{{#var:uses}}|1|55<!-- | ||
+ | --><!----><!---->|{{#vardefine:statename|{{All states and DC|{{#expr:{{#var:i{{#var:uses}}}}-1}}}}}}<!-- | ||
+ | --><!----><!---->{{#if:{{{ {{#var:statename}}| }}}<!-- | ||
+ | --><!----><!----><!---->|{{#vardefine:max|{{#expr:{{#var:max}}+1}}}}<!-- | ||
+ | --><!----><!----><!---->{{#if:{{#var:p{{{ {{#var:statename}} }}}}}<!-- | ||
+ | --><!----><!----><!----><!---->|{{#vardefine:p{{{ {{#var:statename}} }}}|{{#var:p{{{ {{#var:statename}} }}}}},{{#var:statename}}}}<!-- | ||
+ | --><!----><!----><!----><!---->|{{#vardefine:p{{{ {{#var:statename}} }}}|{{#var:statename}}}}<!-- | ||
+ | --><!----><!----><!---->}}<!-- | ||
+ | --><!----><!---->}}<!-- | ||
+ | --><!---->}}<!-- | ||
+ | -->}} | ||
+ | <includeonly> | ||
{| class="wikitable" | {| class="wikitable" | ||
! Place | ! Place | ||
Line 100: | Line 125: | ||
|Oklahoma=12 | |Oklahoma=12 | ||
|Pennsylvania=5 | |Pennsylvania=5 | ||
+ | }} | ||
+ | |- | ||
+ | |<pre> | ||
+ | {{NASAT results by state by year | ||
+ | |Alabama=12, | ||
+ | California=2, | ||
+ | Delaware=6, | ||
+ | Georgia=4, | ||
+ | Illinois=1, | ||
+ | Kentucky=9, | ||
+ | Maryland=6, | ||
+ | Missouri=9, | ||
+ | New York=6, | ||
+ | Ohio=3, | ||
+ | Oklahoma=12, | ||
+ | Pennsylvania=5 | ||
+ | }} | ||
+ | </pre> | ||
+ | |{{NASAT results by state by year | ||
+ | |raw=Alabama=12, | ||
+ | California=2, | ||
+ | Delaware=6, | ||
+ | Georgia=4, | ||
+ | Illinois=1, | ||
+ | Kentucky=9, | ||
+ | Maryland=6, | ||
+ | Missouri=9, | ||
+ | New York=6, | ||
+ | Ohio=3, | ||
+ | Oklahoma=12, | ||
+ | Pennsylvania=5 | ||
}} | }} | ||
|} | |} |
Latest revision as of 11:35, 20 June 2022
This template only considers states + DC.
Input | Output | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{NASAT results by state by year |California=9 |Connecticut=10 |Illinois=2 |Iowa=21 |Kentucky=15 |Maryland=4 |Michigan=7 |Minnesota=13 |Missouri=3 |New Jersey=1 |North Carolina=5 |Pennsylvania=6 }} |
| ||||||||||||||||||||||
{{NASAT results by state by year |Alabama=12 |California=2 |Delaware=6 |Georgia=4 |Illinois=1 |Kentucky=9 |Maryland=6 |Missouri=9 |New York=6 |Ohio=3 |Oklahoma=12 |Pennsylvania=5 }} |
| ||||||||||||||||||||||
{{NASAT results by state by year |Alabama=12, California=2, Delaware=6, Georgia=4, Illinois=1, Kentucky=9, Maryland=6, Missouri=9, New York=6, Ohio=3, Oklahoma=12, Pennsylvania=5 }} |
|
Full state template:
{{NASAT results by state by year |Alabama= |Alaska= |Arizona= |Arkansas= |California= |Colorado= |Connecticut= |Delaware= |District of Columbia= |Florida= |Georgia= |Hawaii= |Idaho= |Illinois= |Indiana= |Iowa= |Kansas= |Kentucky= |Louisiana= |Maine= |Maryland= |Massachusetts= |Michigan= |Minnesota= |Mississippi= |Missouri= |Montana= |Nebraska= |Nevada= |New Hampshire= |New Jersey= |New Mexico= |New York= |North Carolina= |North Dakota= |Ohio= |Oklahoma= |Oregon= |Pennsylvania= |Rhode Island= |South Carolina= |South Dakota= |Tennessee= |Texas= |Utah= |Vermont= |Virginia= |Washington= |West Virginia= |Wisconsin= |Wyoming= }}
Only states that have attended template:
{{NASAT results by state by year |Alabama= |Arizona= |California= |Connecticut= |Delaware= |District of Columbia= |Florida= |Georgia= |Illinois= |Indiana= |Iowa= |Kentucky= |Maryland= |Massachusetts= |Michigan= |Minnesota= |Missouri= |Nevada= |New Hampshire= |New Jersey= |New York= |North Carolina= |Ohio= |Oklahoma= |Pennsylvania= |South Carolina= |Tennessee= |Texas= |Vermont= |Virginia= }}