Template:Test-params/doc

From Angelina Jordan Wiki
Revision as of 11:25, 3 August 2022 by Dcljr (talk | contribs) (…)
This is a subpage documenting Template:Test-params. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template exists only to collect examples that illustrate certain vagaries of MediaWiki templates — in particular, cases where whitespace is or is not preserved, and how that affects the perceived definedness and truth value of the parameters passed to the template.

This is obviously only for the benefit of template editors (and maybe users) on this wiki, so the template should generally not be used outside of the documentation of the template itself (and possibly on talk pages, to explain problems with template calls).

Usage

  • {{test-params}}
  • {{test-params|…}}
  • {{test-params|…|…}}

The only parameters this template checks for are the first two positional ones, known as 1 and 2 (whether they are named in the template call or not). Their behavior in the examples where they are named (e.g., using |1=) is the same as for any other named parameter.

Examples

  • {{test-params}} ⇒ 1 undefined; 2 undefined; fallback value = "default"
  • {{test-params|}} ⇒ 1 defined and false (); 2 undefined; fallback value = ""
  • {{test-params| }} ⇒ 1 defined and false ( ); 2 undefined; fallback value = " "
  • {{test-params|1=}} ⇒ 1 defined and false (); 2 undefined; fallback value = ""
  • {{test-params|1= }} ⇒ 1 defined and false (); 2 undefined; fallback value = ""
  • {{test-params|1=foo}} ⇒ 1 defined and true (foo); 2 undefined; fallback value = "foo"
  • {{test-params|foo}} ⇒ 1 defined and true (foo); 2 undefined; fallback value = "foo"
  • {{test-params||}} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params| |}} ⇒ 1 defined and false ( ); 2 defined and false (); fallback value = " "
  • {{test-params|1=|}} ⇒ 1 defined and false (); 2 undefined; fallback value = "" (bad call: 1 defined twice)
  • {{test-params|1= |}} ⇒ 1 defined and false (); 2 undefined; fallback value = "" (bad call: 1 defined twice)
  • {{test-params|1=foo|}} ⇒ 1 defined and false (); 2 undefined; fallback value = "" (bad call: 1 defined twice)
  • {{test-params|foo|}} ⇒ 1 defined and true (foo); 2 defined and false (); fallback value = "foo"
  • {{test-params|| }} ⇒ 1 defined and false (); 2 defined and false ( ); fallback value = ""
  • {{test-params| | }} ⇒ 1 defined and false ( ); 2 defined and false ( ); fallback value = " "
  • {{test-params|1=| }} ⇒ 1 defined and false ( ); 2 undefined; fallback value = " " (bad call: 1 defined twice)
  • {{test-params|1= | }} ⇒ 1 defined and false ( ); 2 undefined; fallback value = " " (bad call: 1 defined twice)
  • {{test-params|1=foo| }} ⇒ 1 defined and false ( ); 2 undefined; fallback value = " " (bad call: 1 defined twice)
  • {{test-params|foo| }} ⇒ 1 defined and true (foo); 2 defined and false ( ); fallback value = "foo"
  • {{test-params||2=}} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params| |2=}} ⇒ 1 defined and false ( ); 2 defined and false (); fallback value = " "
  • {{test-params|1=|2=}} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params|1= |2=}} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params|1=foo|2=}} ⇒ 1 defined and true (foo); 2 defined and false (); fallback value = "foo"
  • {{test-params|foo|2=}} ⇒ 1 defined and true (foo); 2 defined and false (); fallback value = "foo"
  • {{test-params||2= }} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params| |2= }} ⇒ 1 defined and false ( ); 2 defined and false (); fallback value = " "
  • {{test-params|1=|2= }} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params|1= |2= }} ⇒ 1 defined and false (); 2 defined and false (); fallback value = ""
  • {{test-params|1=foo|2= }} ⇒ 1 defined and true (foo); 2 defined and false (); fallback value = "foo"
  • {{test-params|foo|2= }} ⇒ 1 defined and true (foo); 2 defined and false (); fallback value = "foo"
  • {{test-params||2=bar}} ⇒ 1 defined and false (); 2 defined and true (bar); fallback value = ""
  • {{test-params| |2=bar}} ⇒ 1 defined and false ( ); 2 defined and true (bar); fallback value = " "
  • {{test-params|1=|2=bar}} ⇒ 1 defined and false (); 2 defined and true (bar); fallback value = ""
  • {{test-params|1= |2=bar}} ⇒ 1 defined and false (); 2 defined and true (bar); fallback value = ""
  • {{test-params|1=foo|2=bar}} ⇒ 1 defined and true (foo); 2 defined and true (bar); fallback value = "foo"
  • {{test-params|1= foo |2= bar }} ⇒ 1 defined and true (foo); 2 defined and true (bar); fallback value = "foo"
  • {{test-params|foo|2=bar}} ⇒ 1 defined and true (foo); 2 defined and true (bar); fallback value = "foo"
  • {{test-params||bar}} ⇒ 1 defined and false (); 2 defined and true (bar); fallback value = ""
  • {{test-params| |bar}} ⇒ 1 defined and false ( ); 2 defined and true (bar); fallback value = " "
  • {{test-params|1=|bar}} ⇒ 1 defined and true (bar); 2 undefined; fallback value = "bar" (bad call: 1 defined twice)
  • {{test-params|1= |bar}} ⇒ 1 defined and true (bar); 2 undefined; fallback value = "bar" (bad call: 1 defined twice)
  • {{test-params|1=foo|bar}} ⇒ 1 defined and true (bar); 2 undefined; fallback value = "bar" (bad call: 1 defined twice)
  • {{test-params|foo|bar}} ⇒ 1 defined and true (foo); 2 defined and true (bar); fallback value = "foo"
  • {{test-params| foo | bar }} ⇒ 1 defined and true ( foo ); 2 defined and true ( bar ); fallback value = " foo "
  • {{test-params|ignored=}} ⇒ 1 undefined; 2 undefined; fallback value = "default" (named param not checked for)
  • {{test-params|ignored=|}} ⇒ 1 defined and false (); 2 undefined; fallback value = "" (named param not checked for)
  • {{test-params||ignored=}} ⇒ 1 defined and false (); 2 undefined; fallback value = "" (named param not checked for)
  • {{test-params||ignored=|}} ⇒ 1 defined and false (); 2 defined and false (); fallback value = "" (named param not checked for)