Page MenuHomePhabricator

VisualEditor: When getting TemplateData, VE automatically adds "Template:" even if another namespace is provided
Closed, ResolvedPublic


If you want to add a "template" that is not in the template namespace, for example: "User:UBX"; VE will make an API request like: "GET".

It should automatically detect that "User:" is a valid namespace, and not add the "Template:" prefix.

Version: unspecified
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:57 AM
bzimport set Reference to bz52609.

It looks like we can just pass the title to mw.Title.newFromText with mw.config.get( 'wgNamespaceIds' ).template as the (default) namespace.

(Okay, it's not as simple as I was hoping)

Change 140875 had a related patch set uploaded by Alex Monk:
Handle transcluding templates outside of the template namespace properly

This was also hiding another problem (templates outside of the Template namespace ended up prefixed with ':', breaking them). This patch should fix that too (and hopefully not break any other link suggesting things).

The commit says the purpose of the colon is "to create a link to something that would normally be included as a File/Category".

That's true, but it also plays a role in transclusion. It's used to transclude things in the main namespace.

E.g. on English Wikipedia {{Main Page}} transcludes , whereas {{:Main Page}} transcludes

For other namespaces (e.g. {{Wikipedia:Community Portal}} / {{:Wikipedia:Community Portal}} ), it works either way.

Full demo:

This may be handled somewhere (e.g. Parsoid), but it needs to be tested.

What Matt pointed out is handled correctly except for main namespace titles (e.g. :Foo), where the input widget trips over itself and you always end up with Template:Foo.

Change 140875 merged by jenkins-bot:
Handle transcluding templates outside of the template namespace properly