Template:Xpdnp

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

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[edit]

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

  • {{xpdnp|tc}} gives: {{tc}} gives {{tlc|...}} [1]
  • {{xpdoc|tc}} gives: "{{tc}}" → "{{tlc|...}}" [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}}" → "13:21" [13]