Template:Version: Difference between revisions

From Untold Dawn
Jump to navigation Jump to search
(Created page with "<noinclude>This template helps manage documentation that is version-specific. It allows you to specify which versions a page or section applies to, indicate if something is deprecated, and link to release notes. === Usage === <code><pre><nowiki> {{Version |version= <!-- Required. The main version this content applies to --> |since= <!-- Optional. The version where this feature was introduced --> |until= <!-- Optional. The last version wher...")
 
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 4: Line 4:
<code><pre><nowiki>
<code><pre><nowiki>
{{Version
{{Version
|version=         <!-- Required. The main version this content applies to -->
|version          <!-- Required. The main version this content applies to -->
|since=            <!-- Optional. The version where this feature was introduced -->
|since=            <!-- Optional. The version where this feature was introduced -->
|until=            <!-- Optional. The last version where this feature applies -->
|until=            <!-- Optional. The last version where this feature applies -->
Line 13: Line 13:
</nowiki></pre></code></noinclude>
</nowiki></pre></code></noinclude>
<includeonly>
<includeonly>
{{#vardefine:type|{{{type|page}}}}}
<div class="version-box">
{{#vardefine:version|{{{version|}}}}}
<!-- Check if version provided -->
{{#vardefine:since|{{{since|}}}}}
{{#if:{{{1|}}|
{{#vardefine:until|{{{until|}}}}}
  <!-- Version is provided -->
{{#vardefine:status|{{{status|}}}}}
{{#vardefine:notes|{{{notes|}}}}}


<!-- Styling container -->
  <!-- Construct base message depending on since/until -->
<div class="version-box {{#if:{{#var:status}}|{{#var:status}}|}}">
  {{#if:{{{since|}}}|
 
    <!-- 'since' is provided -->
<!-- If no version is specified, show an error to editors -->
     This {{{type|page}}}, introduced in version {{{since}}}{{#if:{{{until|}}}|
{{#if:{{#var:version}}|
       , applies to versions {{{since}}} through {{{until}}} (current: {{{1}}})
  <!-- If version is provided -->
      | , applies starting from version {{{since}}} (current: {{{1}}})
 
  <!-- Construct the main sentence parts -->
  <!-- Introduced / since -->
  {{#if:{{#var:since}}|
     This {{#var:type}}, introduced in version {{#var:since}}
    {{#if:{{#var:until}}|
       , applies to versions {{#var:since}} through {{#var:until}} (current: {{#var:version}})
    | <!-- else -->
      , applies starting from version {{#var:since}} (current: {{#var:version}})
     }}
     }}
   |<!-- else no since -->
   | <!-- else no 'since' -->
     {{#if:{{#var:until}}|
     {{#if:{{{until|}}}|
       This {{#var:type}} applies up to version {{#var:until}} (current: {{#var:version}})
       This {{{type|page}}} applies up to version {{{until}}} (current: {{{1}}})
    |<!-- else no until -->
      | This {{{type|page}}} applies to version {{{1}}}
      This {{#var:type}} applies to version {{#var:version}}
     }}
     }}
   }}
   }}{{#if:{{{status|}}}|
 
     {{#ifeq:{{{status}}}|deprecated
  <!-- Status messages -->
       | , but is now deprecated.
  {{#if:{{#var:status}}|
      | {{#ifeq:{{{status}}}|removed
     {{#ifeq:{{#var:status}}|deprecated|
        | , but is now removed.
       , but is now deprecated.
        | <!-- No recognized status -->
    |{{#ifeq:{{#var:status}}|removed|
      }}
      , but is now removed.
    }}  
     }}
     }}
   |<!-- else no status -->
   |.}}{{#if:{{{notes|}}}|
     .
     See [[{{{notes}}}]] for more details.
   }}
   }}


  <!-- Notes link -->
| <!-- else no version -->
  {{#if:{{#var:notes}}|
    See [[{{#var:notes}}]] for more details.
  }}
 
|<!-- else no version -->
   <span style="color:red;">Error: No version specified! Please provide a version parameter.</span>
   <span style="color:red;">Error: No version specified! Please provide a version parameter.</span>
}}
}}
</div>
</div>
</includeonly>
</includeonly>

Latest revision as of 23:30, 10 December 2024

This template helps manage documentation that is version-specific. It allows you to specify which versions a page or section applies to, indicate if something is deprecated, and link to release notes.

Usage[edit source]

{{Version
|version          <!-- Required. The main version this content applies to -->
|since=            <!-- Optional. The version where this feature was introduced -->
|until=            <!-- Optional. The last version where this feature applies -->
|status=           <!-- Optional. Can be 'deprecated' or 'removed' -->
|notes=            <!-- Optional. A page or section linking to detailed changelog/release notes -->
|type=             <!-- Optional. Defaults to 'page'. Could be 'section', 'feature', etc. -->
}}