Template:If empty/testcases: Difference between revisions
Template page
More actions
Created page with "{{testcases notice}} {{If empty/sandbox|one|two|three|four}} should be one; {{if empty/sandbox|||||||||nine}} should be nine —<span style="color:#aaaaaa; font-family:Unicode; font-size:12pt;">'''Code'''</span><span style="color:#5577aa;">'''Hydro'''</span> 18:43, 23 December 2014 (UTC) {{Aligned table |class=wikitable |cols=4 |col1style=padding-right:1.0em; |col2style=padding-left:0.5em;padding-right:1.0em; |col3style=padding..." |
(No difference)
|
Latest revision as of 03:35, 15 March 2025
This is the template test cases page for the sandbox of Template:If empty. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
two should be one; should be nine —CodeHydro 18:43, 23 December 2014 (UTC)
Code | Sandbox | Current | |
{{If empty/sandbox}} | Returns an empty string. | ||
{{If empty/sandbox|one}} | one | Returns the first parameter that is defined and not empty. | |
{{If empty/sandbox|one|two}} | two | one | |
{{If empty/sandbox|one|two|three|four}} | two | one | |
{{If empty/sandbox|two}} | two | two | The first parameter is empty/undefined, so is passed over. |
{{If empty/sandbox|two|three|four}} | two | two | |
{{If empty/sandbox|two|four}} | two | two | |
{{If empty/sandbox|||||||||nine}} | nine | ||
{{If empty/sandbox||||||||||ten}} | ten | Empty string returned if maximum of nine parameters exceeded. | |
{{If empty/sandbox}} | The only parameter is empty or undefined, so returns an empty string. | ||
{{If empty/sandbox}} | Returns an empty string. | ||
{{If empty/sandbox|{{{1|}}}|{{{2|}}}|three}} | three | ||
{{If empty/sandbox|{{{1}}}|{{{2}}}|three}} | {{{2}}} | {{{1}}} | No pipe-characters following the names of the first two parameters ("1" and "2"), so the first of these returned as text ("{{{1}}}"). |
{{If empty/sandbox|{{{logo|}}}|two}} | two | two | |
{{If empty/sandbox|{{{logo}}}|two}} | two | {{{logo}}} | No pipe-character following the parameter name "logo", so the text "{{{logo}}}" returned. |
{{If empty/sandbox|2=x}} | x | Unnamed parameters must be defined sequentially. | |
{{If empty/sandbox|p=q}} | The template identifies the parameters it receives as parameters 1 to 9, not using names such as "p", etc. | ||
{{If empty/sandbox|one|{{X1}}[[Category:X1]]}} | one | Parameters after the first non-empty parameter are not expanded, so this page does not transclude Template:X1 and is not in Category:X1. |