Page MenuHomePhabricator

Transcluded substitutions are treated as literals (neither transcluded nor substituted)
Closed, ResolvedPublic


Author: snoutwood

When using the markup {{<includeonly>subst:</includeonly>PAGENAME}} (or any
other magic word. I've tested several and had the same results with all of 'em)
on a page, PAGENAME displays the pagename properly when viewing that page. When
that page is substed into another page, it displays properly as well. However,
when that page is displayed using a template tag (i.e. {{Template:Welcome}}),
what is shown on that page is "{{subst:PAGENAME}}" (for example, here's a
template with said <includeonly> tags: [[en:User:Blackcap/Welcome]], and here's
a page with template tags linking to that page:
[[en:User:Kusma/Sandbox#Welcome.2C_.7B.7Bsubst:PAGENAME.7D.7D.21]]). I reckon
that what should be shown is simply what {{PAGENAME}} would normally show;
thus, the pagename.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:10 PM
bzimport set Reference to bz5453.
bzimport added a subscriber: Unknown Object (MLST).

snoutwood wrote:

Clarification on why I used [[en:Template:Welcome]] as the URL: the bug was
found there while trying to find a way to either subst or not subst PAGENAME on
that template. Discussion: [[en:Template talk:Welcome#PAGENAME issue]].

You're breaking up the markup with other markup; that tends not to work.

snoutwood wrote:

Yet, the additional markup doesn't break when the template is substed. Is that
to be expected?

If it's the addition markup causing the problem, another editor
([[en:User:Kusma]]) suggested that there be an addition of <substonly> and
<nosubst> tags, with the effect that things inside them would only be shown when
the page is substed or displayed, respectively. Thus, one could deal with the
problem by using the markup "<nosubst>{{PAGENAME}}</nosubst>

Wiki.Melancholie wrote:

If it won't work with <includeonly>, will it work like it was requested in bug 4484?
If yes, this bug is a duplicate of bug 4484.

snoutwood wrote:

It might be. If what I'm referring to is a bug with <includeonly>, then no. If
<includeonly> is intended to operate in the way it does, than yes, it would be a
duplicate, and should be marked as such.

ayg wrote:

The bug (if it can be called a bug, strictly speaking) is that transcluding a
substitution is impossible and results in the substitution being treated as a
literal. If you transclude "{{subst:foo}}", it can't be substituted into the
transclusion, obviously, which is why I'm not sure this is really a bug.
Desired behavior is that it be transcluded, with the "subst:" ignored.

On the other hand, until bug 4484 and/or bug 2003 are fixed, this behavior is
important to force people to subst; a number of templates on enwiki are using
this to avoid people accidentally editing a transcluded talk-page template like
[[Template:Image source]] by clicking the section edit link, and IMO it would be
unwise to take that ability away without replacing it.

herd wrote:

*** Bug 8675 has been marked as a duplicate of this bug. ***

conrad.irwin wrote:

A proposed patch

The patch attached adds new syntax


now acts exactly like


always should have. I.e. it expands the template even when it is being included in a template that does not get subst:d.

In other respects


acts exactly like


The alternative way to fix this would be to add a new magic word, this would, in my opinion, be less easy for editors to remember. (That said we don't seem to care much about the usability of template-wikitext).


conrad.irwin wrote:

Since safesubst: was added in r61710. You will be able to use "safesubst:" instead of "subst:" in templates that require transcluded substitution to work, while still being able to use subst: for cases where the template wants to know if it has been subst:d.

conrad.irwin wrote:

Sorry, this particular change was not reverted by Tim, and is in 1.16beta.