Difference between revisions of "Template:Count and list"

From QBWiki
Jump to navigation Jump to search
m
Line 3: Line 3:
 
|{{#vardefineecho:link|{{#explode:{{#var:input}}|,|{{#var:i}}}}}}
 
|{{#vardefineecho:link|{{#explode:{{#var:input}}|,|{{#var:i}}}}}}
 
| <nowiki/>
 
| <nowiki/>
# [[{{#var:link}}]]{{safesubst:Exists|{{#var:link}}|then={{Add|blue_links|1}}|else={{Add|red_links|1}}}}{{Add|i|1}}}}}}
+
# [[{{#var:link}}]]{{subst:Exists|{{#var:link}}|then={{Add|blue_links|1}}|else={{Add|red_links|1}}}}{{Add|i|1}}}}}}
 
This list includes {{#var:blue_links}} blue links and {{#var:red_links}} red links.{{Load|red_links|blue_links|i|link}}</includeonly><noinclude>
 
This list includes {{#var:blue_links}} blue links and {{#var:red_links}} red links.{{Load|red_links|blue_links|i|link}}</includeonly><noinclude>
 
Given a list of fields (comma delimited), count the number of links which point to pages with exist and the number which point to pages that don't.
 
Given a list of fields (comma delimited), count the number of links which point to pages with exist and the number which point to pages that don't.

Revision as of 14:23, 26 August 2022

Given a list of fields (comma delimited), count the number of links which point to pages with exist and the number which point to pages that don't.

Incorporates Template:Exists to circumvent the "500 per page" limit of #ifexist.

Input Output
{{Count and list|
X,
Y,
Z}}
  1. X{{subst:Exists|X|then=|else=}}
  2. Y{{subst:Exists|Y|then=|else=}}
  3. Z{{subst:Exists|Z|then=|else=}}

This list includes 3 blue links and 3 red links.

{{Count and list|
2020 ACF Fall,
2021 ACF Fall,
2022 ACF Regionals}}
  1. 2020 ACF Fall{{subst:Exists|2020 ACF Fall|then=|else=}}
  2. 2021 ACF Fall{{subst:Exists|2021 ACF Fall|then=|else=}}
  3. 2022 ACF Regionals{{subst:Exists|2022 ACF Regionals|then=|else=}}

This list includes 3 blue links and 3 red links.