1.6.5
Now out Kjhf 16:07, 28 May 2011 (UTC)
Simpler code
This code is much simpler and less repetitive:
<includeonly><!--
-->{{#vardefine:beta|1.7.3}}<!--
-->{{#vardefine:beta-server|1.7.3}}<!--
-->{{#vardefine:classic|0.30}}<!--
-->{{#vardefine:classic-server|1.1.2}}<!--
-->{{#vardefine:pocket|0.1}}<!--
-->{{ #if: {{{t|}}}
| {{
#ifeq: {{{1}}} | {{
#switch: {{ #if: {{{p|}}} | 1 | 0 }}{{ #if: {{{c|}}} | 1 | 0 }}{{ #if: {{{s|}}} | 1 | 0 }}
| 000 = B{{#var:beta}}
| 001 = B{{#var:beta-server}}
| 010 = {{#var:classic}}
| 011 = {{#var:classic-server}}
| 100 = {{#var:pocket}}
}}
| style="background: #C6EFCE; color: #006100" {{!}} {{{1}}}<!-- this is the "true" case -->
| style="background: #FFC7CE; color: #9C0006" {{!}} {{{1}}}<!-- this is the "false" case -->
}}
| {{
#switch: {{ #if: {{{p|}}} | 1 | 0 }}{{ #if: {{{c|}}} | 1 | 0 }}{{ #if: {{{s|}}} | 1 | 0 }}
| 000 = {{#var:beta}}
| 001 = {{#var:beta-server}}
| 010 = {{#var:classic}}
| 011 = {{#var:classic-server}}
| 100 = {{#var:pocket}}
}}
}}</includeonly><noinclude>
{{/doc}}
[[Category:Templates|V]]</noinclude>
This code should be easier to maintain, and it also allows any values to be used for "p", "c", "s", and "t" (not really as important, but I've got a thing about only allowing binary parameters to have one possible value) as well as allowing for proper functioning if any of these parameters are defined but empty (which causes any parameter defaults to be ignored). If necessary, I can slap this code on a sandbox subpage and then slap together a testcases subpage to demonstrate that it really does work correctly. 「ダイノガイ千?!」? · ☎ Dinoguy1000 21:50, 18 August 2011 (UTC)
- Code works in the german wiki. -- Oliver Scholz de.Wiki Admin 16:18, 19 August 2011 (UTC)