Template:Xpdnp/doc: Difference between revisions

From FamilySearch Wiki
(Created page with "{{Documentation subpage}} This {{til|xpdnp}} (expansion demo with named parameters) shows the call of a template or switch and its result, for documentation. I...")
 
(added nowiki code to make the wanted templates go away until we actually use this in the Wiki)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
This {{til|xpdnp}} ([[help:expansion|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.
This <nowiki>{{til|xpdnp}}</nowiki> (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==
Examples, compared with equivalent calls of {{tim|xpdoc}}, {{tim|xpdopec}}, and {{tim|xpdopepec}}:
Examples, compared with equivalent calls of {{tim|xpdoc}}, <nowiki>{{tim|xpdopec}}</nowiki>, and <nowiki>{{tim|xpdopepec}}</nowiki>:


*<nowiki>{{xpdnp|tc}}</nowiki> gives: {{xpdnp|tc}}
*<nowiki>{{xpdnp|tc}}</nowiki> gives: {{xpdnp|tc}}
*<nowiki>{{xpdoc|tc}}</nowiki> gives: {{xpdoc|tc}}
*<nowiki>{{xpdoc|tc}}</nowiki> gives: {{xpdoc|tc}}


*<nowiki>{{xpdnp|t np|1n=q|1v=s}}</nowiki> gives: {{xpdnp|t np|1n=q|1v=s}}
*<nowiki>{{xpdnp|t np|1n=q|1v=s}}</nowiki> gives: <nowiki>{{xpdnp|t np|1n=q|1v=s}}</nowiki>
*<nowiki>{{xpdopec|t np|q|s}}</nowiki> gives: {{xpdopec|t np|q|s}}
*<nowiki>{{xpdopec|t np|q|s}}</nowiki> gives: <nowiki>{{xpdopec|t np|q|s}}</nowiki>


*<nowiki>{{xpdnp|p|1n=|1v=q}}</nowiki> gives: {{xpdnp|p|1n=|1v=q}} (the empty string is used as parameter name)
*<nowiki>{{xpdnp|p|1n=|1v=q}}</nowiki> gives:<nowiki>{{xpdnp|p|1n=|1v=q}}</nowiki> (the empty string is used as parameter name)
*<nowiki>{{xpdopec|p||q}}</nowiki> gives: {{xpdopec|p||q}}
*<nowiki>{{xpdopec|p||q}}</nowiki> gives: <nowiki>{{xpdopec|p||q}}</nowiki>


*<nowiki>{{xpdnp|t np2|1n=q|1v=u|2n=s|2v=v}}</nowiki> gives: {{xpdnp|t np2|1n=q|1v=u|2n=s|2v=v}}
*<nowiki>{{xpdnp|t np2|1n=q|1v=u|2n=s|2v=v}}</nowiki> gives: <nowiki>{{xpdnp|t np2|1n=q|1v=u|2n=s|2v=v}}</nowiki>
*<nowiki>{{xpdopepec|t np2|q|u|s|v}}</nowiki> gives: {{xpdopepec|t np2|q|u|s|v}}
*<nowiki>{{xpdopepec|t np2|q|u|s|v}}</nowiki> gives: <nowiki>{{xpdopepec|t np2|q|u|s|v}}</nowiki>


*<nowiki>{{xpdnp|#switch:q|1n=p|1v=u|2n=q|2v=v}}</nowiki> gives: {{xpdnp|#switch:q|1n=p|1v=u|2n=q|2v=v}}
*<nowiki>{{xpdnp|#switch:q|1n=p|1v=u|2n=q|2v=v}}</nowiki> gives: <nowiki>{{xpdnp|#switch:q|1n=p|1v=u|2n=q|2v=v}}</nowiki>
*<nowiki>{{xpdopepec|#switch:q|p|u|q|v}}</nowiki> gives: {{xpdopepec|#switch:q|p|u|q|v}}
*<nowiki>{{xpdopepec|#switch:q|p|u|q|v}}</nowiki> gives: <nowiki>{{xpdopepec|#switch:q|p|u|q|v}}</nowiki>
*<nowiki>{{xpd5opepec||||||#switch:q|p|u|q|v}}</nowiki> gives: {{xpd5opepec||||||#switch:q|p|u|q|v}}
*<nowiki>{{xpd5opepec||||||#switch:q|p|u|q|v}}</nowiki> gives: <nowiki>{{xpd5opepec||||||#switch:q|p|u|q|v}}</nowiki>


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


*<nowiki>{{xpdnp|CURRENTTIME}}</nowiki> gives: {{xpdnp|CURRENTTIME}}
*<nowiki>xpdnp|CURRENTTIME</nowiki> gives: xpdnp|CURRENTTIME


Therefore, for variables use {{tim|xpdoc}} instead:
Therefore, for variables use {{tim|xpdoc}} instead:
*<nowiki>{{xpdoc|CURRENTTIME}}</nowiki> gives: {{xpdoc|CURRENTTIME}}
*<nowiki>xpdoc|CURRENTTIME</nowiki> gives: xpdoc|CURRENTTIME




<!-- template categories and interwiki links -->
<!-- template categories and interwiki links -->
<includeonly></includeonly>
<includeonly></includeonly>

Latest revision as of 17:12, 24 January 2020

This {{til|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 source]

Examples, compared with equivalent calls of >Template:xpdoc (backlinks, edit), {{tim|xpdopec}}, and {{tim|xpdopepec}}:

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

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

  • xpdnp|CURRENTTIME gives: xpdnp|CURRENTTIME

Therefore, for variables use >Template:xpdoc (backlinks, edit) instead:

  • xpdoc|CURRENTTIME gives: xpdoc|CURRENTTIME