Page MenuHomePhabricator

A "do not transclude semantic properties outside of these namespaces" configuration option would be nice
Closed, DeclinedPublic

Description

Author: morgon.kanter

Description:
I run a decent sized wiki (linked in the URL), and we often set semantic properties via infobox templates and general formatting templates, as I think is a pretty standard and useful practice. However, these pages (we'll call one "foo") that use these templates (we'll call one "bar") occasionally get transcluded into other pages (which we'll call "foobar") whose purpose is to compile a large number of foo-pages. However, this brings up a bit of a problem where the properties that are on page foo start showing up on page foobar, which we don't want. However, all those properties are set in template bar, and we also need the formatting aspects from template bar to show up on page foobar, so we can't just surround the inclusion call to bar on page foo in noinclude tags -- then we wouldn't get the information we need onto page foobar. As a result all the properties set by bar show up on foobar -- something we don't want to happen.

To get around this, we kindly request that a new configuration option be added to Semantic MediaWiki, one that says something like "don't transclude properties from pages unless they're in these namespaces". The way it would work would be that if a template (that is in a transclude-okay namespace) gets put onto another page the properties go with it, but if that other page (that is not in a transclude-okay namespace) gets put into another page the properties set by the template do *not* go with it.


Version: unspecified
Severity: enhancement
URL: http://dungeons.wikia.com

Details

Reference
bz21273

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:53 PM
bzimport set Reference to bz21273.

Due to the architecture of MediaWiki and SMW, it is not possible to distinguish between transcluded and directly inserted texts at the time when SMW properties are collected during the processing of a page. I think this would be very hard to change.

Various other options are possible, however:

  • You can generally disable SMW data for some namespace (as already done for templates). The relevant configuration option is explained at [http://semantic-mediawiki.org/wiki/Help:Configuration#smwgNamespacesWithSemanticLinks].
  • You can construct a parser function "#if" that checks the current namespace (there is also a parser function for obtaining it) and that controls whether or not SMW annotations are set based on this information. The disadvantage is a higher number of parser function calls which could hurt performance. If this is not an issue, then yuo could even wrap this intelligence into a template that takes an SMW property name and a value, and that is used instead of SMW syntax in all templates. But large numbers of nested template calls can really be a performance issue.
  • Maybe you can use SMW's format=embed with #ask to make the lists at foobar automatically instead of creating them manually? This format takes care of preventing transclusion of properties (it uses a hack right now, but it does the job, and future versions are very likely to still solve the issue, maybe without the hack).
  • You can also use the hack directly: put [[SMW::off]] ... [[SMW::on]] around any piece of wiki text for which SMW links should be ignored. As I said, this is an undocumented hack, and it will go away without notice or regret as soon as we have time for building a better solution.

I hope that some of the above will be of some use to you. We will not do anything else about the issue for now, as I have no idea how to implement a special handling for transcluded code in a clean way (if this is possible at all).

morgon.kanter wrote:

Could we get [[SMW::off]] and [[SMW::on]] as a documented and persistent feature instead of a hack that might go away? That would be incredibly useful.

[Removing RESOLVED LATER as discussed in http://lists.wikimedia.org/pipermail/wikitech-l/2012-November/064240.html and announced in https://sourceforge.net/mailarchive/forum.php?thread_name=CALFVSbXkiffYy6HkhEWE0RtRrJ%2B2ebPz3g00gsr%2Bdz%2B1nZWsDA%40mail.gmail.com&forum_name=semediawiki-devel . Reopening and setting priority to "Lowest". For future reference, please use either RESOLVED WONTFIX (for issues that will not be fixed), or simply set lowest priority. Thanks a lot!]

Aklapper subscribed.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.