Jump to content

Template:Xpsoc/doc

From mediawiki.org

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

Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern | Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern Template:Expansion demo pattern

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)