Template:Xpdnp

From PortlandWiki
Jump to navigation Jump to search
[edit] [history] [purge] Documentation icon Template documentation

This Template:Xpdnp (expansion demo with named parameters) shows the call of a template or switch and its result, for documentation. It works with up to 6 named parameters.

Examples

Examples, compared with equivalent calls of Template:Xpdoc, Template:Xpdopec, and Template:Xpdopepec:

  • {{xpdnp|tc}} gives: {{tc}} gives in [1]
  • {{xpdoc|tc}} gives: "{{tc}}" → "in" [2]
  • {{xpdnp|t np|1n=q|1v=s}} gives: {{t np|q=s}} gives psr [3]
  • {{xpdopec|t np|q|s}} gives: "{{t np|q=s}}" gives "psr" [4]
  • {{xpdnp|p|1n=|1v=q}} gives: {{p|=q}} gives q [5] (the empty string is used as parameter name)
  • {{xpdopec|p||q}} gives: "{{p|=q}}" gives "q" [6]
  • {{xpdnp|t np2|1n=q|1v=u|2n=s|2v=v}} gives: {{t np2|q=u|s=v}} gives purvt [7]
  • {{xpdopepec|t np2|q|u|s|v}} gives: "{{t np2|q=u|s=v}}" gives "purvt" [8]
  • {{xpdnp|#switch:q|1n=p|1v=u|2n=q|2v=v}} gives: {{#switch:q|p=u|q=v}} gives v [9]
  • {{xpdopepec|#switch:q|p|u|q|v}} gives: "{{#switch:q|p=u|q=v}}" gives "v" [10]
  • {{xpd5opepec||||||#switch:q|p|u|q|v}} gives: "{{#switch:q|p=u|q=v}}" gives "v" [11]

While the template works for templates without parameters it does not work properly for variables:

Therefore, for variables use Template:Xpdoc instead:

  • {{xpdoc|CURRENTTIME}} gives: "{{CURRENTTIME}}" → "04:59" [13]
The above documentation is transcluded from Template:Xpdnp/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Please add categories and interwikis to the /doc subpage. Subpages of this template.