Difference between revisions of "Template:Invocations"
Jump to navigation
Jump to search
Kevin Wang (talk | contribs) (Created page with "<includeonly>{{Add|{{FULLPAGENAME}}_invocations|1}}{{#var:{{FULLPAGENAME}}_invocations}}</includeonly><noinclude> {{Template doc| A simple counter that can be used to track th...") |
Kevin Wang (talk | contribs) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | <includeonly>{{Add|{{FULLPAGENAME}}_invocations|1}}{{#var:{{FULLPAGENAME}}_invocations}}</includeonly><noinclude> | + | <includeonly>{{Add|{{FULLPAGENAME}}_invocations|1}}{{#vardefine:invocations|{{#var:{{FULLPAGENAME}}_invocations}}}}{{#var:invocations}}</includeonly><noinclude> |
{{Template doc| | {{Template doc| | ||
| + | {{Warning|This template has been abandoned because it '''does not work as intended'''. The desired behavior can still be achieved by manually defining a variable and iterating it, but this template's intended usage as a shorthand for defining this variable fails because "<nowiki>{{FULLPAGENAME}}</nowiki>" always takes the name of the outermost page, not any intermediate templates. This means that usages of this template will share a counter between all calls ''on the outermost page'', not all calls on the currently edited template.}} | ||
A simple counter that can be used to track the number of times a particular template has been invoked ''if'' included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables. | A simple counter that can be used to track the number of times a particular template has been invoked ''if'' included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables. | ||
<pre> | <pre> | ||
| − | {{Invocations}} -> {{Invocations}} -> {{Invocations}} ({{#var:Template:Invocations_invocations}}) | + | {{Invocations}} -> {{Invocations}} -> {{Invocations}} ({{#var:Template:Invocations_invocations}}, {{#var:invocations}}) |
| + | |||
| + | {{Invocations/test}} -> {{Invocations/test}} | ||
</pre> | </pre> | ||
| − | {{Invocations}} -> {{Invocations}} | + | {{Invocations/test}} -> {{Invocations/test}} ({{#var:Template:Invocations/test_invocations}}, {{#var:invocations}}) |
}}</noinclude> | }}</noinclude> | ||
Latest revision as of 18:06, 20 December 2025
Template documentation
Warning:
This template has been abandoned because it does not work as intended. The desired behavior can still be achieved by manually defining a variable and iterating it, but this template's intended usage as a shorthand for defining this variable fails because "{{FULLPAGENAME}}" always takes the name of the outermost page, not any intermediate templates. This means that usages of this template will share a counter between all calls on the outermost page, not all calls on the currently edited template.
A simple counter that can be used to track the number of times a particular template has been invoked if included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables.
{{Invocations}} -> {{Invocations}} -> {{Invocations}} ({{#var:Template:Invocations_invocations}}, {{#var:invocations}})
{{Invocations/test}} -> {{Invocations/test}}
1 -> 2 (, 2)