Difference between revisions of "Template:Metadata inherit"

From wiki.vg
Jump to navigation Jump to search
(I'm still not sure why it's adding a newline, but maybe this'll help.)
(Try to fix warnings appearing in code blocks)
Line 12: Line 12:
 
             | {{#vardefine:meta_{{{1}}}|{{{start_at}}}}}
 
             | {{#vardefine:meta_{{{1}}}|{{{start_at}}}}}
 
             <!-- Warn about using both, but still use start_at -->
 
             <!-- Warn about using both, but still use start_at -->
            {{#if:{{#varexists:meta_{{{inherits}}}}}|<strong class="warning">start_at in use when inherited entity {{{inherits}}} exists</strong>}}
+
{{#if:{{#varexists:meta_{{{inherits}}}}}|<strong class="warning">start_at in use when inherited entity {{{inherits}}} exists</strong>}}
 
             | {{#vardefine:meta_{{{1}}}|{{#var:meta_{{{inherits}}}|0}}}}
 
             | {{#vardefine:meta_{{{1}}}|{{#var:meta_{{{inherits}}}|0}}}}
 
             <!-- Warn about nonexistent parent -->
 
             <!-- Warn about nonexistent parent -->
            {{#if:{{#varexists:meta_{{{inherits}}}}}||<strong class="error">Inherited entity {{{inherits}}} does not exist</strong>}}
+
{{#if:{{#varexists:meta_{{{inherits}}}}}||<strong class="error">Inherited entity {{{inherits}}} does not exist</strong>}}
 
         }}
 
         }}
 
         {{#if:{{{pre_start_at|{{{start_at|}}}}}}
 
         {{#if:{{{pre_start_at|{{{start_at|}}}}}}
 
             | {{#vardefine:meta_pre_{{{1}}}|{{{pre_start_at|{{{start_at|}}}}}}}}
 
             | {{#vardefine:meta_pre_{{{1}}}|{{{pre_start_at|{{{start_at|}}}}}}}}
 
             <!-- Warn about using both, but still use start_at -->
 
             <!-- Warn about using both, but still use start_at -->
            {{#if:{{#varexists:meta_{{{pre_inherits|{{{inherits}}}}}}}}|<strong class="warning">start_at in use when inherited entity {{{pre_inherits|{{{inherits}}}}}} exists</strong>}}
+
{{#if:{{#varexists:meta_{{{pre_inherits|{{{inherits}}}}}}}}|<strong class="warning">start_at in use when inherited entity {{{pre_inherits|{{{inherits}}}}}} exists</strong>}}
 
             | {{#vardefine:meta_pre_{{{1}}}|{{#var:meta_pre_{{{inherits}}}|0}}}}
 
             | {{#vardefine:meta_pre_{{{1}}}|{{#var:meta_pre_{{{inherits}}}|0}}}}
 
             <!-- Warn about nonexistent parent -->
 
             <!-- Warn about nonexistent parent -->
            {{#if:{{#varexists:meta_{{{pre_inherits|{{{inherits}}}}}}}}||<strong class="error">Inherited entity {{{pre_inherits|{{{inherits}}}}}} does not exist</strong>}}
+
{{#if:{{#varexists:meta_{{{pre_inherits|{{{inherits}}}}}}}}||<strong class="error">Inherited entity {{{pre_inherits|{{{inherits}}}}}} does not exist</strong>}}
 
         }}
 
         }}
 
         | The base class.
 
         | The base class.
Line 35: Line 35:
 
             | {{#vardefine:meta_{{{1}}}|{{{start_at}}}}}
 
             | {{#vardefine:meta_{{{1}}}|{{{start_at}}}}}
 
             <!-- Warn about using both, but still use start_at -->
 
             <!-- Warn about using both, but still use start_at -->
            {{#if:{{#varexists:meta_{{{inherits}}}}}|<strong class="warning">start_at in use when inherited entity {{{inherits}}} exists</strong>}}
+
{{#if:{{#varexists:meta_{{{inherits}}}}}|<strong class="warning">start_at in use when inherited entity {{{inherits}}} exists</strong>}}
 
             | {{#vardefine:meta_{{{1}}}|{{#var:meta_{{{inherits}}}|0}}}}
 
             | {{#vardefine:meta_{{{1}}}|{{#var:meta_{{{inherits}}}|0}}}}
 
             <!-- Warn about nonexistent parent -->
 
             <!-- Warn about nonexistent parent -->
            {{#if:{{#varexists:meta_{{{inherits}}}}}||<strong class="error">Inherited entity {{{inherits}}} does not exist</strong>}}
+
{{#if:{{#varexists:meta_{{{inherits}}}}}||<strong class="error">Inherited entity {{{inherits}}} does not exist</strong>}}
 
         }}
 
         }}
 
         | The base class.
 
         | The base class.

Revision as of 03:28, 3 May 2019

Provides data for Template:Metadata id.

The first parameter is the name of the entity. The inherits parameter is the name of the entity it inherits from (which, for the root entity, is blank). The start_at variable indicates the starting ID (defaults to 0); it should not be used if the inherited entity is on the page (this is only useful for the root entity and on the pre-release page).

Behavior changes if meta_prerelease is defined; this template then supports optional pre_inherits and pre_start_at parameters, which should only be specified if the values changed. The template will also check if the entity has already been included on the page and decide whether to use a relative link or directly link to Entity metadata.