Page MenuHomePhabricator

frame object should have property indicating subst status
Closed, ResolvedPublic

Description

The frame object should have property indicating subst status, say

frame.isSubsted = true/false

at least for the frame created by {{#invoke:}}, but preferably for parent frame as well.


Version: unspecified
Severity: enhancement

Details

Reference
bz47828

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:20 AM
bzimport added a project: Scribunto.
bzimport set Reference to bz47828.

Looking at how substing actually works, you can't have different "isSubsting" statuses for the different frames:

  • If the parent is being substed, then either the #invoke is being substed too or it's not even processed at that phase of the parse. By the time it is processed, the original parent is already gone and you've got a new one that isn't being substed.
  • If the parent is not being substed, then the #invoke cannot be substed either because there's no place for it to be substed *into*.

So it makes more sense to me to just have a static "mw.isSubsting()" function instead of a method on the frame object.

Also, I note that a hack like enwiki's [[Template:Ifsubst]] works as well in Scribunto:

if frame:preprocess( '{{subst:NAMESPACE}}' ) ~= '{{subst:NAMESPACE}}' then

  • substing

else

  • Not substing

end

Change 93019 had a related patch set uploaded by Anomie:
Add mw.isSubsting()

https://gerrit.wikimedia.org/r/93019

Change 93019 merged by jenkins-bot:
Add mw.isSubsting()

https://gerrit.wikimedia.org/r/93019

Change merged. It should be deployed to WMF wikis with 1.23wmf3, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.

Change 139597 had a related patch set uploaded by MarkAHershberger:
Add mw.isSubsting()

https://gerrit.wikimedia.org/r/139597