v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Difference between revisions of "Template:For-each-version"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Created page with "<includeonly><!-- -->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|}}|$(ver)|50}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|50|{{{selected-value}}}|}}}}<!-- -->{{#m...")
 
(use explicit "Main" - otherwise, links in old versioned namespaces don't work due to the NamespaceLinks extension (Cat in the DF2014 namespace goes to DF2014:Cat))
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<includeonly><!--
 
<includeonly><!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|}}|$(ver)|50}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|50|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|Main}}|$(version)|50}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}||{{{selected-value}}}|}}}}<!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|DF2014}}|$(ver)|0.47}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.47|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|DF2014}}|$(version)|0.47}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}|DF2014|{{{selected-value}}}|}}}}<!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|v0.34}}|$(ver)|0.34}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.34|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|v0.34}}|$(version)|0.34}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}|v0.34|{{{selected-value}}}|}}}}<!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|v0.31}}|$(ver)|0.31}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.31|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|v0.31}}|$(version)|0.31}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}|v0.31|{{{selected-value}}}|}}}}<!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|40d}}|$(ver)|0.28}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.28|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|40d}}|$(version)|0.28}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}|40d|{{{selected-value}}}|}}}}<!--
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|23a}}|$(ver)|0.23}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.23|{{{selected-value}}}|}}}}<!--
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|23a}}|$(version)|0.23}}|$(selected-value)|{{#ifeq: {{{selected-ns}}}|23a|{{{selected-value}}}|}}}}<!--
 
--></includeonly>
 
--></includeonly>
 
<noinclude>
 
<noinclude>
Line 12: Line 12:
 
   for each DF version era:
 
   for each DF version era:
 
     replace $(ns) with the associated namespace, like "40d"
 
     replace $(ns) with the associated namespace, like "40d"
     replace $(ver) with the associated version, like "0.28"
+
     replace $(version) with the associated version, like "0.28"
     if the selected-ver argument was provided, and selected-ver is equal to $(ver):
+
     if the selected-ns argument was provided, and selected-ns is equal to $(ns):
 
       replace $(selected-value) with the selected-value argument
 
       replace $(selected-value) with the selected-value argument
  
 
For example, to list all versions and their namespaces, while highlighting v0.28 in particular, you can use  
 
For example, to list all versions and their namespaces, while highlighting v0.28 in particular, you can use  
  
<pre><nowiki>{{for-each-version|Version "v$(ver)" has namespace "$(ns)" $(selected-value)<br>|selected-ver=0.28|selected-value=<--selected--}}</nowiki></pre>
+
<pre><nowiki>{{for-each-version|Version "v$(version)" has namespace "$(ns)" $(selected-value)<br>|selected-ns=40d|selected-value=<--selected--}}</nowiki></pre>
  
{{for-each-version|Version "v$(ver)" has namespace "$(ns)" $(selected-value)<br>|selected-ver=0.28|selected-value=<--selected--}}
+
{{for-each-version|Version "v$(version)" has namespace "$(ns)" $(selected-value)<br>|selected-ns=40d|selected-value=<--selected--}}
 +
 
 +
[[Category:Version templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 03:19, 14 February 2023


This template repeats a user-provided string once for each DF version era while substituting variables. In pseudocode:

  for each DF version era:
    replace $(ns) with the associated namespace, like "40d"
    replace $(version) with the associated version, like "0.28"
    if the selected-ns argument was provided, and selected-ns is equal to $(ns):
      replace $(selected-value) with the selected-value argument

For example, to list all versions and their namespaces, while highlighting v0.28 in particular, you can use

{{for-each-version|Version "v$(version)" has namespace "$(ns)" $(selected-value)<br>|selected-ns=40d|selected-value=<--selected--}}

Version "v50" has namespace "Main"
Version "v0.47" has namespace "DF2014"
Version "v0.34" has namespace "v0.34"
Version "v0.31" has namespace "v0.31"
Version "v0.28" has namespace "40d" <--selected--
Version "v0.23" has namespace "23a"