Difference between revisions of "Template:Version Nav"

From RimWorld Wiki
Jump to navigation Jump to search
(Special case for 0.0.232 the oldest version)
(automatic release dates)
Line 1: Line 1:
 
<includeonly>
 
<includeonly>
 
{| style="border-collapse:collapse; padding:5px; outline: 1px #E0E0E0 solid;" align=center  
 
{| style="border-collapse:collapse; padding:5px; outline: 1px #E0E0E0 solid;" align=center  
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | Previous Version: {{#switch: {{#vardefineecho:pagename|{{PAGENAME}} }}
+
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | '''Previous Version:''' [[ {{#vardefineecho:nextVersion | {{#switch: {{#vardefineecho:pagename|{{PAGENAME}} }}
| Version/0.0.232 = This is the oldest version.
+
  | Version/0.0.232 = Version history{{!}}This is the oldest version.
| Version/0.2.363 = [[Version/0.1.334]]
+
  | Version/0.2.363 = Version/0.1.334
| Version/1.0.0 = [[Version/0.19.2009]]
+
  | Version/1.0.0 = Version/0.19.2009
| #default = {{#ask: [[Category:Version]] [[<<{{FULLPAGENAME}}]] |format=list |limit=1 |default=none |order=descending |searchlabel=}}
+
  | #default = {{#ask: [[Category:Version]] [[<<{{FULLPAGENAME}}]] | format=list | limit=1 | link=none | default=Version history | order=descending | searchlabel=}} }} }} ]]<br/>'''Released on:''' {{Q|{{#var:previousVersion}}|Release Date|–}}
}}
+
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | '''Next Version:''' [[ {{#vardefineecho:nextVersion | {{#switch: {{#var:pagename}}
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | Next Version: {{#switch: {{#var:pagename}}
+
  | Version/0.1.334 = Version/0.2.363
| Version/0.1.334 = [[Version/0.2.363]]
+
  | Version/0.19.2009 = Version/1.0.0
| Version/0.19.2009 = [[Version/1.0.0]]
+
  | Version/{{Current Version}} = Version history{{!}}This is the newest version
| Version/{{Current Version}} = This is the newest version.
+
  | #default = {{#ask: [[Category:Version]] [[>>{{FULLPAGENAME}}]] | format=list | limit=1 | link=none | default=Version history | order=ascending | searchlabel=}} }} }} ]]<br/>'''Released on:''' {{Q|{{#var:nextVersion}}|Release Date|–}}
| #default = {{#Ask: [[Category:Version]] [[>>{{FULLPAGENAME}}]] |format=list |limit=1 |default=none |order=ascending |searchlabel=}}
+
|}<!--
}}
+
Set the release date
|-
+
-->{{#ifeq: {{{date|}}} | false || {{#set: Release Date = {{{date| {{#time: Y-m-d |@{{#expr: 1361973600 + ({{#explode:{{PAGENAME}}|.|-1}} * 24 * 60 * 60)}} }} }}} }} }}<!--
|}<!-- ''Release on: {{#time: l j F Y|@{{#expr: 1361973600 + ({{#explode:{{PAGENAME}}|.|-1}} * 24 * 60 * 60)}}}}'' works but the dates don't always line up -->
+
Set the category
{{#ifeq: {{#sub:{{#var:pagename}}||8}}|Version/|[[Category:Version|{{#explode:{{#var:pagename}}|.|-3}}.{{#ifexpr: {{#len:{{#explode:{{#var:pagename}}|.|-2}} }} = 1 | 0 }}{{#explode:{{#var:pagename}}|.|-2}}.{{#explode:{{#var:pagename}}|.|-1}}]]}}</includeonly>
+
-->{{#ifeq: {{#sub:{{#var:pagename}}||8}}|Version/|[[Category:Version|{{#explode:{{#var:pagename}}|.|-3}}.{{#ifexpr: {{#len:{{#explode:{{#var:pagename}}|.|-2}} }} = 1 | 0 }}{{#explode:{{#var:pagename}}|.|-2}}.{{#explode:{{#var:pagename}}|.|-1}}]]}}</includeonly><noinclude>{{Documentation}}</noinclude>
<noinclude>{{documentation}}</noinclude>
 

Revision as of 13:24, 2 November 2022

Documentation icon Template documentation[view] [edit] [history] [purge]

Description

Generates a small widget to go to the next version in the Category:Version or Category:Console version

Also handles the categorization of the page and the setting of Property:Release Date and its display. The date is either calculated manually or can be set with date=. For testing purposes like on this page date=false should be set, to forbid that properties are set.

In case of an Unstable version, the field unstable= must be set to 1 (or any non-empty value). This will also set the page property Stable Version=false, for search purposes.

Examples

Standard

{{Version Nav}}

on page Version/0.9.722 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:

Unstable versions

{{Version Nav|unstable=1}}

on page Version/1.5.4101 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:

Special cases

{{Version Nav}}

on page Version/0.9.722 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav|date=2018-10-17}}

on page Version/1.0.0 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav}}

on page Version/0.0.232 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav}}

on page Version/0.1.334 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav}}

on page Version/0.2.363 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav}}

on page Version/0.19.2009 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:
{{Version Nav}}

on page current version would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on:

Console version

{{Version Nav|date=2023-04-25}}

on page Console version/1.21 would produce:

Previous Version: Version history
Released on:
Next Version: Version history
Released on: