Last modified: 2014-06-05 00:54:17 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.
Bug 835 might be relevant to your use-case.
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.
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.
Note that Lua modules are capable of doing this, via frame:getParent():getTitle().