Jump to content

User:Patrick/xpd examples

From Meta, a Wikimedia project coordination wiki

Notes:

  • In the case of multiple spaces use separate parameters for each space.
  • In the case of a single newline use a separate parameter for it.
  • Do not put consecutive single quotes in the same parameter.
  • Put a newline followed by "*", "**", "***", "#", "##", "###", ":", "::", or ":::" together, without anything else in a parameter.
  • A parameter equal to or starting with "*", "#", ":" gives problems in the second part of the output of xpd (the rendering): an excess newline can be avoided with <nowiki/> in front, but if this is inside a link target, the link does not work.
  • Put two consecutive rectangular brackets in different parameters.

Without double or triple braces (plain)

[edit]

For the examples in this section the result of Special:ExpandTemplates is the same as the input.

"{{a| | |bc}}" gives "

" [1]

"{{a| |bc}}" gives "

" [2]

"{{a'|'b'|'c'|'}}" gives "Template:A'" [3]

"{{a|

  • |b|
    • }}" gives "

"{{a|

  1. |b|
  2. }}" gives "
  1. " [5]

"{{a|

  1. |b|
    1. }}" gives "
  1. " [6]

"{{a|

|b|
}}" gives "
" [7]

"{{a| |;|b}}" gives "

" [8]

"{{|----| }}" gives "{{ |----| }}" [9]

"{{&|lt;}}" gives "&" [10]

"{{a[|[b|c]|]d}}" gives "{{a[|[b|c]|]d}}" [11]

xpd: "{{[|[a|*|b]}}" gives "{{[|[a|*|b]}}" [12]; really: "a*b"

"{{[|[Image:Tst.png]|]}}" gives "{{[|[Image:Tst.png]|]}}" [13]

"{{[|[Image:Tst.png|40px|demo]|]}}" gives "{{[|[Image:Tst.png|40px|demo]|]}}" [14]

"{{|{|| class="wikitable sortable"| }}" gives "{{ |{|| class="wikitable sortable"| }}" [15]

"{{o

p<|div>q<|/div>r

s<|div>}}" gives "{{o

p<|div>q<|/div>r

s<|div>}}" [16]

o

s

t

u v

x

y s

t

u v

x

y

z

Rules:

  • <diff> should be followed by a newline
  • </diff> should be preceded by a newline
  • <diff> followed by text on the same line, two newlines and text before </diff> on the same line should be avoided:

o

s

u v

y

u v

s

u v

y

z

Thus two newlines between r and s render together as a space, the single newlines between t and u and between v and x each render as two newlines. This seems due to </div> followed by text on the same line.

Braces

[edit]

Examples without additional parameters:

{{tc}} gives in [17]

{{tcqq}} gives Template:Tcqq [18]

{{CURRENTDAY}} gives 5 [19]

{{#expr:2*3}} gives 6 [20]

{{urlencode:!}} gives %21 [21]

{{uc:abc}} gives ABC [22]

"{{[[Template: | ]]| ||}}" gives "{{ | ||}}" [23]

"{{[[Template:|]]|||}}" gives "{{|||}}" [24]

"{{[|||}}" gives "{{[|||}}" [25]

"{{[|||}}" gives "{{[|||}}" [26]

"{{[|||}}" gives "{{[|||}}" [27]

"{{[|||}}" gives "{{[|||}}" [28]

"{{|||}}" gives "{{|||}}" [29]

"{{|||}}" gives "{{|||}}" [30]

"{{concat|pqr|stu|vwx}}" gives "pqrstuvwx" [31]

"{{#ifeq:2|3|pqr|stu}}" gives "stu" [32]

  • {{formatnum:142857142857142857142857142857142857142857.142857142857142857142857142857142857142857}} gives 142,857,142,857,142,860,000,000,000,000,000,000,000,000.000000000000000000000000000000000000000000 [33]
  • "{{formatnum:| #expr:1/7000000}}" gives "" [34]
  • "{{formatnum:| #expr:1/700000}}" gives "" [35]
  • "{{formatnum:| #expr:1/70000}}" gives "" [36]
  • "{{formatnum:| #expr:1/7000}}" gives "" [37]
  • "{{formatnum:| #expr:1/7}}" gives "" [38]
  • "{{formatnum:| #expr:1000/7}}" gives "" [39]
  • "{{formatnum:| #expr:1000000/7}}" gives "" [40]
  • "{{formatnum:| #expr:100000000/7}}" gives "" [41]
  • "{{formatnum:| #expr:100000000000/7}}" gives "" [42]
  • "{{formatnum:| #expr:1000000000000/7}}" gives "" [43]
  • "{{formatnum:| #expr:10000000000000/7}}" gives "" [44]
  • "{{formatnum:| #expr:100000000000000/7}}" gives "" [45]

Demo of the result produced by a parameter tag

[edit]

Demonstrating the result of a parameter tag seems less useful. It is based on the parameter definitions in the call of xpd, so if xpd is called in another template it is not based on the parameter definitions in the call of that template, i.e., not the parameter definitions valid in the environment of the xpd call. It shows the default, or the value of a parameter used before, inside or after the tag, or a value from a parameter definition that is not shown. ExpandTemplates does not have a context of a template call, so gives the default value.

"{{|||}}" gives "{{|||}}" [46]

"{{|||}}" gives "{{|||}}" [47]

"{{|||}}" gives "{{|||}}" [48]

"{{|||}}" gives "{{|||}}" [49]

"{{|||}}" gives "{{|||}}" [50]

"{{|||}}" gives "{{|||}}" [51]

{{xpd|p=10OpC|q=57|||||||||||q|r}} gives "{{|||}}" gives "{{|||}}" [52]

See also

[edit]