52,563
edits
SilSinn9801 (talk | contribs) (→Template wikicode question: new section) |
m (→Template wikicode question: retiring Template:Tl) |
||
Line 452: | Line 452: | ||
== Template wikicode question == | == Template wikicode question == | ||
I am writing a sandboxed version of the {{ | I am writing a sandboxed version of the {{template|alldex}} row template for use on a draft article ([[User:Force Fire/List of Pokémon that appear in multiple regional Pokédex]]) that is currently nominated for mainspacing. I want this sandboxed version to take into account whether a non-numeric input (like <code>---</code> or <code>???</code>) is fed to any of its parameters. | ||
On the current version in templatespace, whenever a non-numeric input is fed to the <code>s=</code> parameter, as in the following example: | On the current version in templatespace, whenever a non-numeric input is fed to the <code>s=</code> parameter, as in the following example: | ||
Line 464: | Line 464: | ||
This is because of the following numeric comparison statement being executed by the template to determine whether or not to append {{sup/4|Pt}} to the Sdex number: | This is because of the following numeric comparison statement being executed by the template to determine whether or not to append {{sup/4|Pt}} to the Sdex number: | ||
<pre>{{#ifexpr: {{{s|001}}} > 151|{{Sup/4|Pt}}}}</pre> | <pre>{{#ifexpr: {{{s|001}}} > 151|{{Sup/4|Pt}}}}</pre> | ||
The comparison <code><nowiki>{{{s|001}}} > 151</nowiki></code> crashes whenever <code>s=</code> is non-numeric. So, I want to modify my sandboxed copy of {{ | The comparison <code><nowiki>{{{s|001}}} > 151</nowiki></code> crashes whenever <code>s=</code> is non-numeric. So, I want to modify my sandboxed copy of {{template|alldex}} to not execute the numeric comparison above unless the input is purely numeric. | ||
I want to ask if there is a wikicode command (like <code><nowiki>{{#ifnum: {{{in|def}}}|out}}</nowiki></code> or similar) that I can use in my template to check whether the input is a number (positive, negative, etc.) and execute the output only upon meeting that numeric constraint. That way, I could have my template do this without crashing or returning error messages: | I want to ask if there is a wikicode command (like <code><nowiki>{{#ifnum: {{{in|def}}}|out}}</nowiki></code> or similar) that I can use in my template to check whether the input is a number (positive, negative, etc.) and execute the output only upon meeting that numeric constraint. That way, I could have my template do this without crashing or returning error messages: |