Template:For/doc: Difference between revisions
Template page
More actions
Wrap Result-column {{for}} examples in <nowiki> |
Nowiki the {{for}} demo blocks referencing nonexistent templates |
||
| Line 142: | Line 142: | ||
|- | |- | ||
|List of all numbers from 100 to 199, separated by commas:<br> | |List of all numbers from 100 to 199, separated by commas:<br> | ||
<pre>1{{for|, 1|call=x1 | <pre>1<nowiki><nowiki>{{for|, 1|call=x1 | ||
|00|01|02|03|04|05|06|07|08|09 | |00|01|02|03|04|05|06|07|08|09 | ||
|10|11|12|13|14|15|16|17|18|19 | |10|11|12|13|14|15|16|17|18|19 | ||
| Line 153: | Line 153: | ||
|80|81|82|83|84|85|86|87|88|89 | |80|81|82|83|84|85|86|87|88|89 | ||
|90|91|92|93|94|95|96|97|98|99 | |90|91|92|93|94|95|96|97|98|99 | ||
}}</pre><nowiki> | }}</nowiki></nowiki></pre><nowiki> | ||
<nowiki>|1{{for|, 1|call=x1 | <nowiki>|1<nowiki><nowiki>{{for|, 1|call=x1 | ||
|00|01|02|03|04|05|06|07|08|09 | |00|01|02|03|04|05|06|07|08|09 | ||
|10|11|12|13|14|15|16|17|18|19 | |10|11|12|13|14|15|16|17|18|19 | ||
| Line 165: | Line 165: | ||
|80|81|82|83|84|85|86|87|88|89 | |80|81|82|83|84|85|86|87|88|89 | ||
|90|91|92|93|94|95|96|97|98|99 | |90|91|92|93|94|95|96|97|98|99 | ||
}}</nowiki></nowiki> | }}</nowiki></nowiki></nowiki></nowiki> | ||
|- | |- | ||
|An example used in {{tl|Facts/Major cities}}:<br> | |An example used in {{tl|Facts/Major cities}}:<br> | ||
Revision as of 11:46, 12 August 2026
The template calls a specified template several times, where one parameter takes each of a list of values; in addition to the variable parameter, for up to 4 parameters a fixed value can be specified.
Usage
{{for
|1 =
|call =
|pc1n =
|pc1v =
|pc2n =
|pc2v =
|pc3n =
|pc3v =
|pc4n =
|pc4v =
|pv =
|prefix =
|postfix =
|2 =
}}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | separator | What to separate entries with | empty | suggested |
call | template | The template to call in each iteration | void | required |
pc1n | constant parameter 1 | The first constant parameter’s name | empty | optional |
pc1v | constant value 1 | The first constant parameter’s value | empty | optional |
pc2n | constant parameter 2 | The second constant parameter’s name | empty | optional |
pc2v | constant value 2 | The second constant parameter’s value | empty | optional |
pc3n | constant parameter 3 | The third constant parameter’s name | empty | optional |
pc3v | constant value 3 | The third constant parameter’s value | empty | optional |
pc4n | constant parameter 4 | The fourth constant parameter’s name | empty | optional |
pc4v | constant value 4 | The fourth constant parameter’s value | empty | optional |
pv | variable parameter | The variable parameter’s name | 1 | optional |
prefix | variable prefix | Constant prefix of the variable parameter’s value | empty | optional |
postfix | variable postfix | Constant postfix of the variable parameter’s value | empty | optional |
23 4 … | variable parameters | The variable parameters’ values. Each value goes in its own parameter, starting with parameter 2. | empty | required |
Additional information
The template is intended to be used in the following namespaces: no namespace specified
The template is intended to be used by the following user groups: no user group specified
Localization
This template is not intended to be localized.
Example
| Code | Result |
|---|---|
List of all numbers from 100 to 199, separated by commas:1<nowiki>{{for|, 1|call=x1
|00|01|02|03|04|05|06|07|08|09
|10|11|12|13|14|15|16|17|18|19
|20|21|22|23|24|25|26|27|28|29
|30|31|32|33|34|35|36|37|38|39
|40|41|42|43|44|45|46|47|48|49
|50|51|52|53|54|55|56|57|58|59
|60|61|62|63|64|65|66|67|68|69
|70|71|72|73|74|75|76|77|78|79
|80|81|82|83|84|85|86|87|88|89
|90|91|92|93|94|95|96|97|98|99
}}</nowiki>
<nowiki>|1<nowiki><nowiki>{{for|, 1|call=x1
|00|01|02|03|04|05|06|07|08|09
|10|11|12|13|14|15|16|17|18|19
|20|21|22|23|24|25|26|27|28|29
|30|31|32|33|34|35|36|37|38|39
|40|41|42|43|44|45|46|47|48|49
|50|51|52|53|54|55|56|57|58|59
|60|61|62|63|64|65|66|67|68|69
|70|71|72|73|74|75|76|77|78|79
|80|81|82|83|84|85|86|87|88|89
|90|91|92|93|94|95|96|97|98|99
}}</nowiki></nowiki></nowiki>
| |
An example used in {{Facts/Major cities}}:{{for||pc1n=decade|pc1v={{{2|{{{decade|}}}}}}|call=Facts/placeParts
|Amsterdam|Bangkok|Barcelona|Beijing|Berlin|Brussels|Buenos Aires|Cairo|Canton|Cape Town|Chicago|Delhi|Dubai|Frankfurt am Main|Geneva|Hong Kong|Istanbul|Jerusalem|Kolkata|Lagos, Nigeria|London|Los Angeles|Madrid|Mexico City|Moscow|Mumbai|Nairobi|New York City|Osaka|Paris|Rio de Janeiro (city)|Rome|São Paulo (city)|San Francisco|Seoul|Shanghai|Singapore|Stockholm|Sydney|Tokyo|Toronto|Washington, D.C.|Wuhan}}
|
Lua error: expandTemplate: template "Facts/placeParts" does not exist. |
Note that the last part of the separator is used as a prefix; the first prefix needs to be put separately.