Difference between revisions of "Template:Metadata id"
Jump to navigation
Jump to search
(Create template. Hopefully this is functional (and the whitespace doesn't cause issues). I do need to create a second template that controls part of this.) |
(Fix switch issues) |
||
Line 4: | Line 4: | ||
{{#vardefine:pre_meta|{{#var:meta_pre_{{#var:meta_current_entity}}}}}} | {{#vardefine:pre_meta|{{#var:meta_pre_{{#var:meta_current_entity}}}}}} | ||
{{#switch: {{{1|unchanged}}} | {{#switch: {{{1|unchanged}}} | ||
− | | added | + | | added = |
{{change||{{#var:pre_meta}}}} | {{change||{{#var:pre_meta}}}} | ||
{{#vardefine:meta_pre_{{#var:meta_current_entity}}|{{#expr:{{#var:pre_meta}}+1}}}} | {{#vardefine:meta_pre_{{#var:meta_current_entity}}|{{#expr:{{#var:pre_meta}}+1}}}} | ||
− | | removed | + | | removed = |
{{change|{{#var:cur_meta}}|}} | {{change|{{#var:cur_meta}}|}} | ||
{{#vardefine:meta_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}} | {{#vardefine:meta_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}} | ||
− | | unchanged | + | | unchanged = |
{{#ifeq: {{#var:cur_meta}}|{{#var:pre_meta}}| {{#var:cur_meta}} | {{change|{{#var:cur_meta}}|{{#var:pre_meta}}}} }} | {{#ifeq: {{#var:cur_meta}}|{{#var:pre_meta}}| {{#var:cur_meta}} | {{change|{{#var:cur_meta}}|{{#var:pre_meta}}}} }} | ||
{{#vardefine:meta_pre_{{#var:meta_current_entity}}|{{#expr:{{#var:pre_meta}}+1}}}} | {{#vardefine:meta_pre_{{#var:meta_current_entity}}|{{#expr:{{#var:pre_meta}}+1}}}} | ||
{{#vardefine:meta_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}} | {{#vardefine:meta_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}} | ||
− | | <strong class="error">Invalid parameter to [[Template:Metadata id]] {{{1}}}</strong> | + | | <strong class{{=}}"error">Invalid parameter to [[Template:Metadata id]] {{{1}}}</strong> |
}} | }} | ||
| <!-- Full release mode --> | | <!-- Full release mode --> |
Revision as of 02:02, 3 May 2019
Used to generate incremental entity metadata IDs.
cur_meta
and pre_meta
are local variables, to avoid redundancy. meta_current_entity
is defined elsewhere, and meta_entity
and meta_pre_entity
are accessed via it. Those two values are incremented after this template.
Behavior changes if a meta_prerelease
variable is defined: the template supports an optional parameter which may be set to unchanged
(default), added
, or removed
, which can be used to mark metadata entries that were added or removed in the prerelease.