Difference between revisions of "Template:Version Nav"

From RimWorld Wiki
Jump to navigation Jump to search
(Adding a property to handle unstable versions. I really hope this helps with the issue with "Current Version")
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<includeonly>{{#vardefine:fullPageName|{{{page|{{FULLPAGENAME}}}}}}}{{#ifeq:{{#rpos:{{#var:fullPageName}}|Console version}}|-1|{{#vardefine:versionType|PC version}}|{{#vardefine:versionType|Console version}}}}<!--
 +
Find the previous version
 +
-->{{#vardefine:previousVersion | {{#switch: {{#vardefineecho:pagename|{{PAGENAME}} }}
 +
  | Version/0.0.232 = Version history
 +
  | #default = {{#ask: [[Category:{{#var:versionType}}]] [[Release Date::<<{{Q|{{#var: fullPageName}}|Release Date}}]] | format=plainlist | limit=1 | link=none | default=Version history | order=descending | sort=Release Date| searchlabel=}} }} }}<!--
 +
Find the next version
 +
-->{{#vardefine:nextVersion | {{#switch: {{#var:pagename}}
 +
  | Version/{{Current Version}} = Version history
 +
  | #default = {{#ask: [[Category:{{#var:versionType}}]] [[Release Date::>>{{Q|{{#var: fullPageName}}|Release Date}}]] | format=plainlist | limit=1 | link=none | default=Version history | order=ascending | sort=Release Date| searchlabel=}} }} }}
 
{| 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: {{#Ask: [[Category:Version]] [[<<{{PAGENAME}}]] |format = list |limit = 1 |default=none |order=descending |searchlabel = | sort = Name}}
+
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | '''Previous Version:''' [[{{#var:previousVersion}}]]<br/>'''Released on:''' {{Q|{{#var:previousVersion}}|Release Date|}}
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | Next Version: {{#Ask: [[Category:Version]] [[>>{{PAGENAME}}]] |format = list |limit = 1 |default=none |order=ascending |searchlabel = | sort = Name}}
+
| style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;" | '''Next Version:''' [[{{#var:nextVersion}}]]<br/>'''Released on:''' {{Q|{{#var:nextVersion}}|Release Date|–}}
|-
+
<!-- Adds a disclaimer for unstable versions. -->
|} [[Category:Version]] <!---''Release on: {{#time: l j F Y|@{{#expr: 1361973600 + ({{#explode:{{PAGENAME}}|.|-1}} * 24 * 60 * 60)}}}}'' works but the dates don't always line up ---->
+
{{#if: {{{unstable|}}} | <tr style="border: 1px #A0A0A0 solid; background-color: #eee; padding: 5px 10px;"><th colspan=2>UNSTABLE</th><tr> | }}
<noinclude>
+
|}<!--
{{documentation}}
+
Set and print the release date
[[Category: Templates]]
+
-->{{#ifeq: {{{date|}}} | false || {{#set: Release Date = {{{date| {{#time: Y-m-d |@{{#expr: 1361973600 + ({{#explode:{{#var: fullPageName}}|.|-1}} * 24 * 60 * 60)}} }} }}} }} }}
</noinclude>
+
''Released on: {{Q|{{#var: fullPageName}}|Release Date|–}}''<br/>
 +
----<!--
 +
Sets a property to differentiate Experimental from Stable versions, but not for testing pages. It's here rather that inside the previous ifeq for clarity sake.
 +
-->{{#ifeq: {{{date|}}} | false || {{#if: {{{unstable|}}}|{{#set: Stable Version=false}}|{{#set: Stable Version=true}} }} }}<!--
 +
Set the category
 +
-->{{#ifeq: {{#sub:{{#var:pagename}}||8}}|Version/|[[Category:PC version|{{#explode:{{#var:pagename}}|.|-3}}.{{#ifexpr: {{#len:{{#explode:{{#var:pagename}}|.|-2}} }} = 1 | 0 }}{{#explode:{{#var:pagename}}|.|-2}}.{{#explode:{{#var:pagename}}|.|-1}}]]}}{{#ifeq: {{#sub:{{#var:pagename}}||16}}|Console version/|[[Category:Console version]]}}</includeonly><noinclude>{{Documentation}}</noinclude>

Latest revision as of 19:30, 20 August 2024

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

Description[edit]

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[edit]

Standard[edit]

{{Version Nav}}

on page Version/0.9.722 would produce:

Previous Version: Version/0.8.657
Released on: 16 December 2014
Next Version: Version/0.10.785
Released on: 23 April 2015

Released on: 19 February 2015


Unstable versions[edit]

{{Version Nav|unstable=1}}

on page Version/1.5.4101 would produce:

Previous Version: Version/1.5.4097
Released on: 17 May 2024
Next Version: Version/1.5.4104
Released on: 24 May 2024
UNSTABLE

Released on: 21 May 2024


Special cases[edit]

{{Version Nav}}

on page Version/0.9.722 would produce:

Previous Version: Version/0.8.657
Released on: 16 December 2014
Next Version: Version/0.10.785
Released on: 23 April 2015

Released on: 19 February 2015


{{Version Nav|date=2018-10-17}}

on page Version/1.0.0 would produce:

Previous Version: Version/0.19.2009
Released on: 29 August 2018
Next Version: Version/1.0.2096
Released on: 24 November 2018

Released on: 17 October 2018


{{Version Nav}}

on page Version/0.0.232 would produce:

Previous Version: Version history
Released on:
Next Version: Version/0.0.245
Released on: 30 October 2013

Released on: 17 October 2013


{{Version Nav}}

on page Version/0.1.334 would produce:

Previous Version: Version/0.0.254B
Released on: 7 November 2013
Next Version: Version/0.2.363
Released on: 26 February 2014

Released on: 27 January 2014


{{Version Nav}}

on page Version/0.2.363 would produce:

Previous Version: Version/0.1.334
Released on: 27 January 2014
Next Version: Version/0.3.410
Released on: 13 April 2014

Released on: 26 February 2014


{{Version Nav}}

on page Version/0.19.2009 would produce:

Previous Version: Version/0.18.1722
Released on: 15 November 2017
Next Version: Version/1.0.0
Released on: 17 October 2018

Released on: 29 August 2018


{{Version Nav}}

on page current version would produce:

Previous Version: Version/1.5.4136
Released on: 25 June 2024
Next Version: Version history
Released on:

Released on: 8 October 2024


Console version[edit]

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

on page Console version/1.21 would produce:

Previous Version: Console version/1.11
Released on: 8 December 2022
Next Version: Console version/1.22
Released on: 4 May 2023

Released on: 25 April 2023