Jump to content

Help:Parameter default

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2601:844:180:47e5:c994:7c70:40eb:cb7 (talk) at 08:24, 25 June 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Limitation

In the case of multiple default parts, only the first applies: [a|b|c|d] is equivalent with [a|b]. The default part can only contain "|" as part of full template, parameter or link syntax within it, and within nowiki-tags. Note that "|" can be avoided in table syntax by applying HTML coding (element "<table>").

The expression for the parameter name can also contain "|", as part of full template or parameter syntax within it.

Examples, using Template:x3 containing "<noinclude>{{Please leave this line alone (template sandbox heading)}}<!-- * Welcome to the template sandbox! * * Please leave this part alone * * The page is cleared regularly * * Feel free to try your editing skills below * ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■--></noinclude>"
and Template:t2 containing "[[w:List of people by name: {{{1}}}{{{2}}}|{{{1}}}{{{2}}}]]<noinclude>[[Category:Help:Templates templates]]</noinclude>":

  • {{{a|b|c|d}}} gives b
  • {{{a|{{x3|b}}}}} gives
  • {{{a|{{{b|c}}}}}} gives c
  • {{{a|[[b|c]]}}} gives c
  • {{{{{x3|a}}|b}}} gives b - parameter aaa is undefined
  • {{{{{{a|b}}}|c}}} gives c - parameter b is undefined
  • {{{a|<nowiki>b|c</nowiki>}}} gives b|c - works fine for rendering text, but is not suitable for putting parameters b and c in a template call (there is no function for removing nowiki tags):
    {{t2|{{{a|<nowiki>b|c</nowiki>}}}}} gives [[w:List of people by name: b|c{{{2}}}|b|c{{{2}}}]]