WP:SAFESUBST

From Iwe

Revision as of 23:10, 8 September 2014 by IWEWrestling2012 (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

The safesubst: modifier

Template:Shortcut The subst: modifier can be replaced by the alternative modifier safesubst:. The two have the same behaviour, except when they are encountered during non-substituted expansion (transclusion or direct viewing) of a template. In this situation, the code {{subst:...}} remains unparsed, whereas {{safesubst:...}} is treated as if no modifier were present (so the subtemplate is transcluded or the variable or parser function evaluated).

Hence the safesubst: modifier is used in the code of templates which are designed to produce recursive substitution when substituted, but are also intended to work when transcluded – or simply to be viewed directly. Using plain subst: in such templates would break in the case of transclusion (and possibly on direct viewing). For details on how to implement this (in particular, how to prevent the substitution from being performed as soon as the template code is saved), see the next section, Recursive substitution.

Personal tools