Last modified: 2014-06-30 19:40:32 UTC
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 https://en.wikipedia.org/w/api.php?format=json&action=templatedata&titles=Template%3AUser%3AUBX". It should automatically detect that "User:" is a valid namespace, and not add the "Template:" prefix.
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 https://gerrit.wikimedia.org/r/140875
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 https://en.wikipedia.org/wiki/Template:Main_Page , whereas {{:Main Page}} transcludes https://en.wikipedia.org/wiki/Main_Page For other namespaces (e.g. {{Wikipedia:Community Portal}} / {{:Wikipedia:Community Portal}} ), it works either way. Full demo: https://en.wikipedia.org/w/index.php?title=User:Superm401/Sandbox&oldid=614564227 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 https://gerrit.wikimedia.org/r/140875