Page MenuHomePhabricator

Add parameter type for page titles in the Template namespace
Closed, ResolvedPublic

Description

Currently template data supports "wiki-page-name" which indicate a parameter is expected a name of wiki page in the current wiki. It would be useful to extend it with some extra parameter that describes the expected namespace of the page. For example, [[:en:Template:Tl]] expects to get a page in template namespace.

Some additional information for the motivation for creating this bug: there is also user script/gadget that use templatedata to autocomplete templates in wikitext interface [https://en.wikipedia.org/wiki/Wikipedia:User_scripts#cite_ref-49]. Such script can take advantage of this indication and suggest only pages in template namespace.

Event Timeline

eranroz raised the priority of this task from to Needs Triage.
eranroz updated the task description. (Show Details)
eranroz added a project: TemplateData.
eranroz subscribed.
Jdforrester-WMF set Security to None.
Krinkle lowered the priority of this task from Medium to Low.May 8 2015, 3:47 AM
Krinkle subscribed.

Types don't take parameters, and I don't believe this is a valid use case that would justify introducing an extra dimension to the fundamental principle of the type system.

The other features should suffice in describing templates like like {{Tl}}.

We have wiki-file-name and wiki-user-name, for example. Because while those have associated wiki pages, they are their own object type. For example, files may not have a description page, or come from a foreign wiki. Users may not have a user page.

We could provide a similar types for other object types in MediaWiki. Depending on whether there's sufficient need for this. Candidates that come to mind are:

  • Categories. (May not have a description page. Has existing API.)
  • Interface messages (May not exist locally, plus the MediaWiki namespace includes subpages that are themselves not message keys. Has existing API.)

A generic "namespaced" page name type would be too generic and would encourage template constructs that are not user friendly

Templates currently do not have their own object type within the MediaWIki eco system. They exist as regular pages that can be transcluded as any other (see also T98562, which exposes this problem).

Still, we can create a "wiki-template-name" type and tie it to a namespace (even though it doesn't have its own entity type internally, like users, files and categories do). We need to be careful to not imply that this type accepts any valid transcludable page name, since virtually any kind could be transcludable.

Krinkle renamed this task from Add parameter for namespace of wiki-page-name type to Add parameter type for page titles in the Template namespace.May 8 2015, 3:48 AM
Krinkle raised the priority of this task from Low to Medium.
Krinkle moved this task from Backlog to Next-up on the TemplateData board.

Change 239184 had a related patch set uploaded (by Jforrester):
Add a wiki-template-name type for template names

https://gerrit.wikimedia.org/r/239184

Change 239184 merged by jenkins-bot:
Add a wiki-template-name type for template names

https://gerrit.wikimedia.org/r/239184