Last modified: 2011-12-06 20:03:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33709, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31709 - parser template stack
parser template stack
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.17.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-14 21:41 UTC by Daniel A. R. Werner
Modified: 2011-12-06 20:03 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel A. R. Werner 2011-10-14 21:41:52 UTC
As far as I can see, there isn't any stack keeping track which is the current template/site the parser is processing right now (besides the main title Parser::$mTitle of course).
I am not completely sure whether this could even be done with the current parser layout, but I guess it could be done somehow within Parser::braceSubstitution().
There are no hooks getting called at all yet I believe.

Knowing which template/site the code processed in various hooks is coming from would be extremely helpful in a hand full of extensions I've been working on, so this info should be publicly accessible from any Parser object.

For example, this would give parser functions the information which template they are called from and would allow some {{THISPAGENAME}} variable. Just for fun, I tried to implement this in MW 1.17 but it seems impossible with the current structure (at least as real parser function, some '__PAGENAME__' thingy would probably work).
Comment 1 Daniel A. R. Werner 2011-12-06 20:03:14 UTC
Actually, the {{THISPAGENAME}} is possible via PPFrame::getTitle() or in older MW versions PPFrame::$mTitle, overlooked that before. I have written an extension 'Parser Fun' which introduces a {{THIS}} variable for that.
Still not sure about the whole stack though. Just looked into the code, I think PPTemplateFrame_DOM::$parent works for that.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links