Difference between revisions of "Template:Metadata id"

From wiki.vg
Jump to navigation Jump to search
(Yet another strange possibility. For the record, the issue is that vardefines seem not to be "sticking" when the parameter is not specified, though it works if manually set to unchanged...)
(OK, let's try it like this instead)
Line 3: Line 3:
 
     {{#vardefine:cur_meta|{{#var:meta_{{#var:meta_current_entity}}}}}}
 
     {{#vardefine:cur_meta|{{#var:meta_{{#var:meta_current_entity}}}}}}
 
     {{#vardefine:pre_meta|{{#var:meta_pre_{{#var:meta_current_entity}}}}}}
 
     {{#vardefine:pre_meta|{{#var:meta_pre_{{#var:meta_current_entity}}}}}}
     {{#vardefine:mode|{{{1|unchanged}}}}}
+
     {{#switch: {{{1}}}
    {{#switch: {{#var:mode}}
 
 
     | added =
 
     | added =
 
         {{change||{{#var:pre_meta}}}}
 
         {{change||{{#var:pre_meta}}}}
Line 11: Line 10:
 
         {{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 =
+
     | =
 
         {{#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_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}}
 
         {{#vardefine:meta_{{#var:meta_current_entity}}|{{#expr:{{#var:cur_meta}}+1}}}}
Line 26: Line 25:
 
<code>cur_meta</code> and <code>pre_meta</code> are local variables, to avoid redundancy.  <code>meta_current_entity</code> is defined elsewhere, and <code>meta_<var>entity</var></code> and <code>meta_pre_<var>entity</var></code> are accessed via it.  Those two values are incremented after this template.
 
<code>cur_meta</code> and <code>pre_meta</code> are local variables, to avoid redundancy.  <code>meta_current_entity</code> is defined elsewhere, and <code>meta_<var>entity</var></code> and <code>meta_pre_<var>entity</var></code> are accessed via it.  Those two values are incremented after this template.
  
Behavior changes if a <code>meta_prerelease</code> variable is defined: the template supports an optional parameter which may be set to <code>unchanged</code> (default), <code>added</code>, or <code>removed</code>, which can be used to mark metadata entries that were added or removed in the prerelease.
+
Behavior changes if a <code>meta_prerelease</code> variable is defined: the template supports an optional parameter which may be set to blank, <code>added</code>, or <code>removed</code>, which can be used to mark metadata entries that were added or removed in the prerelease.
 
</noinclude>
 
</noinclude>

Revision as of 03:13, 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 blank, added, or removed, which can be used to mark metadata entries that were added or removed in the prerelease.