Template:Dialog/psub
This is a dialog formatting template. It is meant for use on interactive dialog pages, and may involve interactions between wiki markup, HTML, and JavaScript. Please carefully test any edits before making them. |
This template simulates substitution of incoming dialog parameters for template parameters in a wiki text.
Usage
editSpecify the wiki text through template parameter text
. Specify the name and value of an incoming dialog parameter through template parameters nk
and vk
for integer k in the range from 1 to 20 (as of this writing).
{{Dialog/psub|text=foo{{{bar}}}quux|n1=bar|v1=baz}}
would expand to
foobazquux
Template parameters are only substituted for if their default value in text
does not contain any nested curly braces; thus, given markup {{{foo|{{{bar|quux}}}}}}
, incoming dialog parameter bar
would be substituted for, but not incoming dialog parameter foo
. (This faithfully reproduces a limitation of dialog substitution for incoming dialog parameters.)
Reserved dialog parameters are not automatically handled.
If the value substituted for a parameter contains certain characters with format meaning in wiki markup, those characters are not naively substituted in, but instead are replaced by wiki markup for calls to suitable character-substitution templates, just as dialog substitution does to preserve parse structure.
{{Dialog/psub|text=foo{{{bar}}}quux|n1=bar|v1=<>}}
would expand to
foo{{(\}}{{\)}}quux