ထႅမ်းပလဵၵ်ႉ:Xpd

လုၵ်ႉတီႈ ဝီႇၶီႇၽီးတီးယႃး ဢၼ်လွတ်ႈလႅဝ်းထၢင်ႇႁၢင်ႈ ၼၼ်ႉမႃး
Jump to navigation Jump to search

"{{{{{1}}}}}" gives "{{{{{1}}}}}" [1]

Documentation icon ၽိုၼ်လိၵ်ႈထႅမ်းပလဵၵ်ႉ[တူၺ်း] [မႄးထတ်း] [ပိုၼ်း] [ၵဵင်ႈသႂ်]

The expansion demo templates (see [2]) show, for documentation:

  • some wikitext
  • its rendering
  • a link to ExpandTemplates applied to the wikitext; thus it shows:
    • The expanded wikitext.
    • The rendering of this expanded wikitext

Template:xpd (backlinks edit) selects one of the following four templates based on the number of unnamed parameters

တူဝ်ယၢင်ႇ[မႄးထတ်းငဝ်ႈငႃႇ]

{{xpd|CURRENTDAY}} gives:

"{{CURRENTDAY}}" gives "21" [3]

{{xpd|#expr:2+2}} gives:

"{{#expr:2+2}}" gives "4" [4]

For more examples see the separate templates.

ပႃႇရႃႇမီႇတႃႇ တူဝ်ၶႅၼ်ႈ[မႄးထတ်းငဝ်ႈငႃႇ]

The default separator is "gives". With gives={{!}}{{!}} to get "||" for use in a table, the same separator is used before the ExpandTemplates link.

Example:

{| class="wikitable"
!wikitext!!result!!ExpandTemplates
|-
|{{xpd|CURRENTDAY|gives={{!}}{{!}}}}
|-
|{{xpd|#expr:2+2|gives={{!}}{{!}}}}
|}

gives

wikitext result ExpandTemplates
"{{CURRENTDAY}}" "21" [5]
"{{#expr:2+2}}" "4" [6]

Quotes[မႄးထတ်းငဝ်ႈငႃႇ]

The quotation marks are needed to see spaces and newlines at the start and end of the result. In other expand demo templates they are also needed to see spaces and newlines at the start and end of the wikitext, and to get a result independent of whether it starts on a line due to parameter {{{gives}}}.

လွင်ႈမၵ်းၶၢၼ်း[မႄးထတ်းငဝ်ႈငႃႇ]

This Template:Xpd is a simplified version of some expansion demo templates. If necessary use the proper extended version.

Named parameters and parameter values with equals signs[မႄးထတ်းငဝ်ႈငႃႇ]

Named parameters are not supported. Neither are equals signs in parameter values of the template or parser function demonstrated.

Examples:

  • {{xpd|1x| p{{=}}q }} gives "{{1x|[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]}}" gives " p=q " [7] - wrong result due to the template call in the parameter; is corrected by substitution and putting nowiki tags in the lefthand side (see below), giving {{1x| p{{=}}q }} gives p=q [8].
  • {{xpd|1x|2= p=q }} gives "{{1x|[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]}}" gives "p=q" [9] - wrong result because the lefthand side would be expanded interpreting p as named parameter, while the righthand side shows the result if the unnamed parameter of 1x has the given value; use {{xpdopec|1x|1|3= p=q }} giving "{{1x|1=p=q}}[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]" gives "p=q" [10] or {{xpdn|1x|1n=1|1v= p=q }} giving {{1x{{ {{{2}}}}}}} gives {{1x{{{{{2}}}}}}} (spaces and newlines are trimmed).
  • {{xpd|2x|q=s}} gives: "{{2x}}" gives "{{{1}}}{{{1}}}" [11] ("q=s" is ignored); instead, use {{xpdopec|2x|q|s}} giving "{{2x|q=s}}[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]][[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]" gives "{{{1}}}{{{1}}}" [12] or {{xpdn|2x|1n=q|1v=s}} giving {{2x{{ {{{2}}}}}}} gives {{2x{{{{{2}}}}}}}.

Even in the case of a parser function called with a parameter containing an equals sign the template for named parameters should be used:

  • {{xpd|#if:x|p=q}} gives: "{{#if:x}}" gives "" [13] ("p=q" is ignored); instead, use {{xpdn|#if:x|1n=p|1v=q}} giving {{#if:x{{ {{{2}}}}}}} gives .

Rendering of left side[မႄးထတ်းငဝ်ႈငႃႇ]

If no value for parameter p is given, the left-hand side, before "gives", does not show the literal wikitext of the parameters of the template or parser function demonstrated, but the rendering. This affects e.g. sequences of more than two spaces, and single newlines. Also link code is shown as a link. Furthermore, any templates and parser functions in the parameters are expanded; m:Template:xpdn (backlinks edit) covers the simpler of such cases.

Examples:


{{xpd|1x|[[Help:Link]]}}

{{xpd|tl|p
q}}

gives:


"{{1x|[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]}}" gives "Help:Link" [14]

"{{tl|[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]}}" gives "{{[[Template:p q|p q]]}}" [15]


With substitution of xpd1 etc. (see below) and putting nowiki tags around the list of parameters the left hand side is corrected.

Also the input text of ExpandTemplates in the supplied link is the result of expanding the parameters.

လွၵ်းပဝ်ႇ လႄႈ ထႅဝ်မႂ်ႇ[မႄးထတ်းငဝ်ႈငႃႇ]

If parameters start or end with a space or newline, these are preserved. Even if the left-hand side, as mentioned, does not show the raw wikitext of the parameters but the rendering, the right-hand side gives the correct result.

တႅၼ်းတၢင်[မႄးထတ်းငဝ်ႈငႃႇ]

  • {{subst:xpd|substnp=subst:|t1|p}} gives the wikitext {{xpd1|t1|p}}
  • {{subst:xpd|substnp=subst:|t2|p|q}} gives the wikitext {{xpd2|t2|p|q}}
  • {{subst:xpd|substnp=subst:|concat|p|q|r}} gives the wikitext {{xpd3|concat|p|q|r}}

Note that except in the case of long and complicated parameters, adding the number of parameters after "xpd" is easier than adding "subst:" and "|substnp=subst:".

With substitution of xpd1 etc. and putting nowiki tags around the list of parameters the left hand side is given literally without conversions, see also above.

တူၺ်းပႃး[မႄးထတ်းငဝ်ႈငႃႇ]

  • m:Template:tlx (backlinks edit) - produces just the template call, with the template name linked to the template, but not the result, e.g. "{{tlx|t2|b|c}}" gives "{{t2|b|c}}" [16]

Undocumented (so far):

Other formatting templates[မႄးထတ်းငဝ်ႈငႃႇ]

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{tl2|Hatnote|lang=fr}} {{hatnote}} Supports linking to sister projects (e.g., fr:Hatnote)
{{tlu|User:Ahunt/SSHFS}} {{User:Ahunt/SSHFS}} Supports linking to any namespace
{{demo|<nowiki>{{Hatnote|lang=fr|Some text}}</nowiki>}}
{{hatnote|lang=fr|Some text}}

Some text
Shows code and example
{{xpd|Hatnote|Some hatnote text}} "{{hatnote|[[:ထႅမ်းပလဵၵ်ႉ:Xpd/code]]}}" gives "
Some hatnote text
" [17]
Shows code, example and a link to expand the template code
{{tln|Hatnote}} Template:Hatnote Produces a normal link to the template
{{elc|Template:Hatnote}}
{{elc|Template:Hatnote|Hatnote}}
[[Template:Hatnote]]
[[Template:Hatnote|Hatnote]]
Formats wikilink, with optional piped link text and blended suffix
{{ml|Example|hello}} {{#invoke:Example|hello}} Counterpart to {{tl}} for linking to Lua modules
{{mlx|Example|hello}} {{#invoke:Example|hello}} Counterpart to {{tlx}} for linking to Lua modules
{{para|title|<var>book title</var>}} |title=book title Formats template parameters for display, with or without values
{{sclx|LASTING}} [[WP:LASTING]] Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a <code>...</code> tag.
{{tag|ref}}
{{xtag|templatedata}}
<ref>...</ref>
<templatedata>
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
{{dtl|Ping project}} {{d:Ping project}} Wikidata counterpart to {{tl}}
{{pf|if}}
{{pf|if|{{{1}}}|true|false}}
{{#if}}
{{#if:{{{1}}}|true|false}}
Parser function equivalent to {{tl}}
{{magic word|uc:}} {{uc:}} Magic word links