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 "User:OddballJoe/VersionLoop"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Created page with "{{#mreplace: {{{1}}}|$(ns)|Main}} {{#mreplace: {{{1}}}|$(ns)|DF2014}} <noinclude>{{User:OddballJoe/VersionLoop|abc$(ns)def}}</noinclude>")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#mreplace: {{{1}}}|$(ns)|Main}}
+
<includeonly><!--
{{#mreplace: {{{1}}}|$(ns)|DF2014}}
+
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|}}|$(ver)|50}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|50|{{{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)|v0.34}}|$(ver)|0.34}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.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)|40d}}|$(ver)|0.28}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.28|{{{selected-value}}}|}}}}<!--
 +
-->{{#mreplace: {{#mreplace: {{#mreplace: {{{1}}}|$(ns)|23a}}|$(ver)|0.23}}|$(selected-value)|{{#ifeq: {{{selected-ver}}}|0.23|{{{selected-value}}}|}}}}<!--
 +
--></includeonly>
 +
<noinclude>
 +
This template repeats a user-provided string once for each DF version era while substituting variables. In pseudocode:
  
<noinclude>{{User:OddballJoe/VersionLoop|abc$(ns)def}}</noinclude>
+
  for each DF version era:
 +
    replace $(ns) with the associated namespace, like "40d"
 +
    replace $(ver) with the associated version, like "0.28"
 +
    if the selected-ver argument was provided, and selected-ver is equal to $(ver):
 +
      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
 +
 
 +
<pre><nowiki>{{User:OddballJoe/VersionLoop|Version "v$(ver)" has namespace "$(ns)" $(selected-value)<br>|selected-ver=0.28|selected-value=<--selected--}}</nowiki></pre>
 +
 
 +
{{User:OddballJoe/VersionLoop|Version "v$(ver)" has namespace "$(ns)" $(selected-value)<br>|selected-ver=0.28|selected-value=<--selected--}}
 +
</noinclude>

Latest revision as of 02:12, 4 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 $(ver) with the associated version, like "0.28"
    if the selected-ver argument was provided, and selected-ver is equal to $(ver):
      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

{{User:OddballJoe/VersionLoop|Version "v$(ver)" has namespace "$(ns)" $(selected-value)<br>|selected-ver=0.28|selected-value=<--selected--}}

Version "v50" has namespace ""
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"