Jump to content

User:This, that and the other/subst and safesubst

From Wikipedia, the free encyclopedia

safesubst: is the only one to display as expected when transcluded and when subsituted.

Transclusion of template - no parameter

[edit]

In this case, the desired output of the tests is AWWW.


Start of template

  • Parameter 1: {{{1}}}.
  • Parameter 1 or nothing: .
  • "YEAH" if parameter 1 set, "AWWW" if parameter 1 not set ({{#if:{{{1|}}}|YEAH|AWWW}}): AWWW
  • The same #if switch, but with <includeonly>subst:</includeonly> code: {{subst:#if:|YEAH|AWWW}}
  • The same #if switch, but with sub<includeonly></includeonly>st: code: {{subst:#if:|YEAH|AWWW}}
  • The same #if switch, but with <includeonly>safesubst:</includeonly> code: AWWW

End of template


Transclusion of template - with parameter

[edit]

In this case, the desired output of the tests is YEAH.


Start of template

  • Parameter 1: Bonjour.
  • Parameter 1 or nothing: Bonjour.
  • "YEAH" if parameter 1 set, "AWWW" if parameter 1 not set ({{#if:{{{1|}}}|YEAH|AWWW}}): YEAH
  • The same #if switch, but with <includeonly>subst:</includeonly> code: {{subst:#if:Bonjour|YEAH|AWWW}}
  • The same #if switch, but with sub<includeonly></includeonly>st: code: {{subst:#if:Bonjour|YEAH|AWWW}}
  • The same #if switch, but with <includeonly>safesubst:</includeonly> code: YEAH

End of template


Substitution of template - no parameter

[edit]

In this case, the desired output is the text AWWW cleanly substituted into the page.


Start of template

  • Parameter 1: {{{1}}}.
  • Parameter 1 or nothing: .
  • "YEAH" if parameter 1 set, "AWWW" if parameter 1 not set ({{#if:{{{1|}}}|YEAH|AWWW}}): AWWW
  • The same #if switch, but with <includeonly>subst:</includeonly> code: AWWW
  • The same #if switch, but with sub<includeonly></includeonly>st: code: AWWW
  • The same #if switch, but with <includeonly>safesubst:</includeonly> code: AWWW

End of template


Substitution of template - with parameter

[edit]

In this case, the desired output of the tests is the text YEAH cleanly substituted into the page.


Start of template

  • Parameter 1: Bonjour.
  • Parameter 1 or nothing: Bonjour.
  • "YEAH" if parameter 1 set, "AWWW" if parameter 1 not set ({{#if:{{{1|}}}|YEAH|AWWW}}): YEAH
  • The same #if switch, but with <includeonly>subst:</includeonly> code: YEAH
  • The same #if switch, but with sub<includeonly></includeonly>st: code: YEAH
  • The same #if switch, but with <includeonly>safesubst:</includeonly> code: YEAH

End of template