Last modified: 2014-06-05 00:54:17 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 T24588, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22588 - Templates can't detect whether they're included directly or through another page
Templates can't detect whether they're included directly or through another page
Status: NEW
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-19 19:13 UTC by JMJimmy
Modified: 2014-06-05 00:54 UTC (History)
5 users (show)

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


Attachments

Description JMJimmy 2010-02-19 19:13:21 UTC
In specific use cases there is currently no way to detect the following:

ArticleA contains this code:

{{TemplateX}}

ArticleB contains this code:

{{:ArticleA}}

TemplateX is unable to detect when it is being included in ArticleB.

Why this is a problem:
In several scenarios you want something to automatically occur when TemplateX is used, by example: Adding a page to a specific category.  This is often not the desired result on composite pages like ArticleB that want to display the content of ArticleA but not necessarily use all the features related to it.  Because of the include flow the only means to modify TemplateX's behaviour on the two separate pages would be to detect when {{: is being used.  There is currently no mechanism for that.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2010-02-19 19:15:25 UTC
Bug 835 might be relevant to your use-case.
Comment 2 JMJimmy 2010-02-19 19:26:20 UTC
It is related, though more directly related to categories which is merely an example.  The core issue is being able to detect the difference, as you appropriately adjusted the title to reflect, between a direct inclusion and inclusion through another page.
Comment 3 Edward Rudd 2010-05-25 20:54:15 UTC
I would like to be able to "detect" inclusion, but more specifically for extensions.

I have an parser hook extension that attaches on to a <changesignature> tag, and I need the tag to be attached to the page that contains the tag not the one that included it.

ie.. I am creating a large policy manual and am using this extension (that I wrote) to track acceptance of the changes by staff.  And the HR dept is wanting to split the manual into multiple pieces to easier maintenance as well as to track signatures per-section.  However the tag doesn't get processed until after inclusion is done so I lose the originating page.

Right now I'm walking through the code to determine where the inclusion happens to I can *hack in* a hook to provide me this functionality so I can modify the <changesignature> tag to include the original page ID as an attribute/argument.
Comment 4 Jackmcbarn 2014-06-05 00:54:17 UTC
Note that Lua modules are capable of doing this, via frame:getParent():getTitle().

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


Navigation
Links