Jump to content

Template:Xpsoc

From Meta, a Wikimedia project coordination wiki
Template documentation

This is a simplified expansion demo template.

Purposes of the simplification are:

  • reducing the number of required expansion demo templates, by reducing the number of distinguished patterns, and/or making a single template support multiple patterns
  • simplifying the calls of these templates; for example, if a parameter of the demonstrated template is represented by a single parameter of the expansion demo template, this reduces the number of pipe characters in the call, and makes the call of the expansion demo template more resemble the call of the demonstrated template

Limitations:

  • empty and undefined parameters are treated the same
  • a newline in the wikitext is displayed as a space, so it is not possible to properly demonstrate the special effects of the characters *#:; after a newline, and table syntax, and a double newline
  • trimming of values of named parameters is not demonstrated, the values are shown trimmed in the displayed wikitext; the same for parameter names

Thus we get the wrong:

{{2x|

  • a}}
  • a
  • a

Compare the correct:

"{{2x| *a}}" → " *a *a" [1]

"{{2x| *a}}" → "

Also we get the wrong:

{{2x}} → {{{1}}}{{{1}}}

Compare the correct:

"{{2x}}" → "{{{1}}}{{{1}}}" [3]

A newline is displayed as a space, while the result takes into account the newline: {{xpsoc|1x|a|
b

c}}

gives:

{{1x|a b

c}} → a b

c (wrong)

Compare the correct:

{{xpdop3c|1x|a|
|b|
|
|c}}

gives:

"{{1x|a
b}}

c"
→ "a b

c" [4]


This template works for the patterns "oc", for which the more advanced versions are the following ones:

pattern template 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
oc Template:Xpdoc " { { 1 } } 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 "
5oc Template:Xpd5oc " 1 2 3 4 5 { { 6 } } 7 8 9 10 11 12 13 14 15 16 "
10oc Template:Xpd10oc " 1 2 3 4 5 6 7 8 9 10 { { 11 } } 12 13 14 15 16 "
5o5c Template:Xpd5o5c " 1 2 3 4 5 { { 6 7 8 9 10 } } 11 12 13 14 15 16 "
opec Template:Xpdopec " { { 1 | 2 = 3 } } 4 5 6 7 8 9 10 11 12 13 14 "
5opec Template:Xpd5opec " 1 2 3 4 5 { { 6 | 7 = 8 } } 9 10 11 12 13 14 "
op3c Template:Xpdop3c " { { 1 | 2 3 4 } } 5 6 7 8 9 10 11 12 13 14 15 "
o5p5c Template:Xpdo5p5c " { { 1 2 3 4 5 | 6 7 8 9 10 } } 11 12 13 14 15 16 17 "
op3p3c Template:Xpdop3p3c " { { 1 | 2 3 4 | 5 6 7 } } 8 9 10 11 12 13 14 15 16 "
op14c Template:Xpdop14c " { { 1 | 2 3 4 5 6 7 8 9 10 11 12 13 14 15 } } "
op10pec Template:Xpdop10pec " { { 1 | 2 3 4 5 6 7 8 9 10 11 | 12 = 13 } } "
5op3c Template:Xpd5op3c " 1 2 3 4 5 { { 6 | 7 8 9 } } 10 11 12 13 14 15 "
5op3p3c Template:Xpd5op3p3c " 1 2 3 4 5 { { 6 | 7 8 9 | 10 11 12 } } 13 14 "
opepec Template:Xpdopepec " { { 1 | 2 = 3 | 4 = 5 } } 6 7 8 9 10 11 12 "
5opepec Template:Xpd5opepec " 1 2 3 4 5 { { 6 | 7 = 8 | 9 = 10 } } 11 12 "
op3pec Template:Xpdop3pec " { { 1 | 2 3 4 | 5 = 6 } } 7 8 9 10 11 12 "
5op3pec Template:Xpd5op3pec " 1 2 3 4 5 { { 6 | 7 8 9 | 10 = 11 } } 13 14 "
5op3p3p3c Template:Xpd5op3p3p3c " 1 2 3 4 5 { { 6 | 7 8 9 | 10 11 12 | 13 14 15 } } "
5op3p3pec Template:Xpd5op3p3pec " 1 2 3 4 5 { { 6 | 7 8 9 | 10 11 12 | 13 = 14 } } "
opepepec Template:Xpdopepepec " { { 1 | 2 = 3 | 4 = 5 | 6 = 7 } } 8 9 10 11 12 "
5opepepec Template:Xpd5opepepec " 1 2 3 4 5 { { 6 | 7 = 8 | 9 = 10 | 11 = 12 } } "

Naming scheme:

  • o = double opening braces
  • c = double closing braces
  • p = pipe character
  • e = equals sign
  • number = number of text parameters (at the start: instead of none; elsewhere: instead of one), to allow a space or newline as value of a separate parameter (this is required for proper processing)