Last modified: 2014-03-06 18:21:47 UTC
Consider the following links: 1) https://en.wikipedia.org/wiki/Special:PagesWithProp/templatedata?limit=100 2) https://pt.wikipedia.org/wiki/Special:PagesWithProp/templatedata?limit=100 As you can see, the same template data is being associated to more than one template: 1) On enwiki, both "Template:Foo" and "Template:Foo/doc" 2) On ptwiki, both "Template:Foo", "Template:Foo/doc" and "Template:Foo/dados" Using <includeonly><templatedata>...JSON...</templatedata></includeonly> on "/doc" and "/dados" would make it impossible to preview the table in the same page. I think a better approach would be to have a specific namespace, say "JSON:" (take this just as an example) such that "JSON:XYZ" would hold the JSON for "Template:XYZ" (and no other template). So it could be transcluded to "/doc" subpages IF the users want that table in the middle of the documentation (which is not always desirable, since it seems a little technical for newbie users, repetitive - because of the template name, its label and its description - and will be too big for templates with a lot of parameters and aliases)
Another solution to the problem of the data being associated both to "Template:Foo" and to "Template:Foo/doc" (although I don't like it as much as a brand new namespace) would be to have an extra parameter which could be used to suppress the data on /docs and only get the table there. Template:Foo/doc could use something like this: <templatedata <noinclude>TABLEONLY=YES</noinclude> >...JSON...</templatedata> or even <templatedata {{#switch: {{FULLPAGENAME}} |Template:Foo|Template:Foo2|...|Template:Foo9 |#default = TABLEONLY=YES }} >...JSON...</templatedata> (when the same /doc is used for more than one template)
Note that it being applied to both /doc and the Template page is not part of the design from TemplateData but part of the way en.wikipedia.org uses it. Though there are good reasons for it to be that way (I mean, operations actually encourages to use /doc, as otherwise editing the <templatedata> block on Template:Foo will invalidate that template and as such a million articles instead of editing /doc which will only invalidate render cache for Template:Foo itself).
I the spirit of avoiding bugs dictating solutions but instead asking to solve a problem, I'm renaming this bug to reflect the problem so that it can be marked as fixed regardless of how we end up solving it.
(In reply to comment #2) > Note that it being applied to both /doc and the Template page is not part of > the design from TemplateData but part of the way en.wikipedia.org uses it. I think the "/doc" structure is used in a lot of wikis (at least ptwiki and ptwikibooks uses this model) > Though there are good reasons for it to be that way (I mean, operations > actually encourages to use /doc, as otherwise editing the <templatedata> > block > on Template:Foo will invalidate that template and as such a million articles > instead of editing /doc which will only invalidate render cache for > Template:Foo itself). Well.. we are having to do the null edits in the templates anyway because of bug 50372
(In reply to comment #4) > (In reply to comment #2) > > Though there are good reasons for it to be that way (I mean, operations > > actually encourages to use /doc, as otherwise editing the <templatedata> > > block > on Template:Foo will invalidate that template and as such a million > > articles instead of editing /doc which will only invalidate render cache > > for Template:Foo itself). > > Well.. we are having to do the null edits in the templates anyway because of > bug 50372 Null edits. Actual content changes (like putting a <templatedata> block in) would cause a full re-render, I believe.
A lot of templates are protected or semi-protected this means there is a practical problem with people adding the templatedata to the actual template. Null edits are now less of a problem since a change which makes null edits not request recursive page loads and added action=purge&forcerecursivelinkupdate=1 for when you want all transcluding page to be reloaded.
About the "new namespace" proposal, see also: https://www.mediawiki.org/wiki/Thread:Extension_talk:TemplateData/TemplateData_expansion_to_Data