Last modified: 2010-02-10 15:11:24 UTC
A number of templates on Wikipedia, such as those for placing boilerplate messages on user talk pages, are intended to be substituted. However, doing so creates a bit of markup bloat because of the conditional stuff in them. In other words, inserting e.g. {{subst:uw-test1}} on a page copies not only the text that actually appears on the page, but also the {{#if:...}} stuff that is in the template code. The current workaround is to use {{subst:uw-test1|subst:subst=}} However, it seems likely that very few people (remember to) do this every time. It would therefore be good to have a keyword that defers substitution of a template within a template until the outer template is substituted. I propose that subst1 be used for this purpose. Let Template:Outer contain {{subst1:Inner}}. When viewing Template:Outer, this would display the contents of Template:Inner, just as if {{Inner}} had been used by itself. However, when {{subst:Outer}} is later entered on another page, the substitution process would automagically change {{subst1:Inner}} to {{subst:Inner}}, which is then immediately replaced by the contents of Template:Inner. This would enable templates that use the |subst:subst= idiom to shrink slightly, from {{{{{subst|}}}#if:{{{2|}}}|{{{2}}}|Thank you.}} to {{subst1:#if:{{{2|}}}|{{{2}}}|Thank you.}} and at the same time stop people having to (forget to) add |subst:subst= to reduce the amount of markup code generated by these message templates.
I don't know if it would be worth implementing higher levels of deferred substition - subst2 would become subst1 when substed, and so on....
Oops ... I've just realised I typed "subst:subst=" a few times when I meant "subst=subst:". This brings out another problem with this idiom: it's prone to mistyping; this is another good reason to implement this feature to supersede it. -- ~~~~
Since safesubst: was added in r61710. You will be able to use: {{<includeonly>safesubst:</includeonly>#if:{{{2|}}}|{{{2}}}|Thank you.}}, or if you want slightly shorter syntax: {{ {{{|safesubst:}}}#if:{{{2|}}}|{{{2}}}|Thank you. }} The user of the template can use {{subst:uw-test1}} like normal, and {{safesubst:uw-test1}} would also work. See http://en.wikipedia.org/wiki/Help:Substitution#safesubst: for more information.
Then this isn't WFM - it's a duplicate. (Well, technically, that's a duplicate of this, but now that r61710 has been filed against bug 22297....) The help page states that it doesn't yet work. Does this mean that the feature has been folded into the codebase, but WP hasn't yet been updated to the latest version? *** This bug has been marked as a duplicate of bug 22297 ***
(In reply to comment #4) > Then this isn't WFM - it's a duplicate. (Well, technically, that's a duplicate > of this, but now that r61710 has been filed against bug 22297....) > I closed it as WFM because the implementated solution does not act quite like the solution proposed here. > The help page states that it doesn't yet work. Does this mean that the feature > has been folded into the codebase, but WP hasn't yet been updated to the latest > version? > Yes.