Page MenuHomePhabricator

Transclusion dialog should not suggest documentation sub pages as templates
Closed, ResolvedPublic

Description

Currently the the transclusion editor's list of templates includes /Doc and other subpages of templates that are not themselves actual templates.

At https://en.wikipedia.org/wiki/Wikipedia:VisualEditor/Feedback/Archive_2013_2#Removing_template_subpages_from_the_template_selection_list.3F there was a discussion about this which suggested possible ways forward:

  • Exclude all subpages except those explicitly marked as templates, e.g by magic word or category
  • Include all subpages except those explicitly marked as not being templates, e.g. by magic word or category

See also:

Details

Reference
bz52448
Related Gerrit Patches:
mediawiki/extensions/VisualEditor : masterMWTemplateTitleInputWidget: Filter out templates named '…/doc'
mediawiki/extensions/TemplateData : masterDon't store templatedata pageprop on doc-subpage

Related Objects

StatusAssignedTask
Resolvedppelberg
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedbrion
Resolveddaniel
Resolveddaniel
Resolveddaniel
Resolveddaniel
Resolveddaniel
Resolveddaniel
OpenNone
OpenNone
Resolvedawight
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedovasileva
OpenNone
OpenEdtadros
OpenNone
OpenNone
Resolveddaniel
ResolvedJdforrester-WMF
Resolveddaniel
ResolvedJdforrester-WMF
ResolvedJdforrester-WMF
OpenNone
DuplicateNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
Opendaniel
Resolveddaniel
Resolveddaniel
OpenCCicalese_WMF
OpenNone
Opendaniel
Resolveddaniel
Invaliddaniel
DuplicateNone
ResolvedAnomie
ResolvedAnomie
ResolvedAnomie
ResolvedAddshore
Resolveddaniel
ResolvedAnomie
ResolvedNone
DuplicateNone
StalledNone
Resolveddaniel
ResolvedAddshore
Resolveddaniel
ResolvedMarostegui
ResolvedAddshore
ResolvedMarostegui
ResolvedTgr
DuplicateNone
ResolvedAddshore
Resolveddaniel
OpenNone
OpenNone
OpenNone
Resolveddaniel
Resolveddaniel
Resolveddaniel
ResolvedTgr
ResolvedTgr
ResolvedTgr
ResolvedBstorm
ResolvedCCicalese_WMF
OpenNone
OpenVedmaka
OpenNone
OpenAnomie
Resolveddaniel
Opendaniel
ResolvedAnomie
ResolvedAnomie
OpenAnomie
OpenNone
OpenNone
Opendaniel
OpenNone
OpenAnomie
Resolveddaniel
Resolveddaniel
InvalidTgr
ResolvedAnomie
ResolvedAnomie
OpenNone
OpenNone
OpenNone
Resolveddaniel
DuplicateNone
ResolvedAnomie
ResolvedAnomie
ResolvedTgr
ResolvedTgr
OpenNone
OpenNone
Resolveddaniel
ResolvedBPirkle

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:46 AM
bzimport set Reference to bz52448.
Thryduulf created this task.Aug 2 2013, 9:16 AM
Jdforrester-WMF lowered the priority of this task from High to Medium.Jan 9 2015, 10:55 PM
Krinkle renamed this task from VisualEditor: Transclusion dialog should not show documentation etc. sub-pages in list of suggested templates to Transclusion dialog should not suggest documentation sub pages as templates.May 8 2015, 3:51 AM
Krinkle updated the task description. (Show Details)
Krinkle set Security to None.
Krinkle added a subscriber: Aklapper.

Suggested possible ways forward:

  • Exclude all subpages except those explicitly marked as templates, e.g by magic word or category
  • Include all subpages except those explicitly marked as not being templates, e.g. by magic word or category

Neither of these options are imho maintainable or author-friendly. Alternative ideas (from T98562).

  • Filter out /doc (hardcoded).
    • Principally not as ugly as one might think, since TemplateData does this as well. Though TemplateData only uses that hardcoded value to discover related pages in the graphical interface. It is in no way enforced server-side or encouraged in its interface when inserting/editing template data.
    • We'd have to filter it client-side, which means the number of results shown is inconsistent. To avoid false positives with template names that actually end in "/doc", we'd only remove results if the other title is also in the list. (E.g. "Template:Dac/duc/doc" or something like that.)
  • Filter out results that are transcluded in other results.
    • Requires an additional query somewhere, but might be a smart way to do it. We'd only omit results that are transcluded by others. So "Template:Foo/doc" would be omitted because according to the link tables, "Template:Foo" (also in the suggestions) transcludes "Template:Foo/doc". This doesn't work well because documentation pages themselves often make use of various other templates. So any template used in the preview, examples, or documentation would never show up in the suggestions.
  • Filter out results that transclude template data.
    • Not sure how this would work, but since the same duplication is also present in the page-property index (which is where template data is stored), we can detect that Foo and Foo/doc both have (the same) template data. We may be able to de-duplicate results that way (and pick the one that sorts higher, or the one with a shorter name, aka not the helper page that tends to be a sub page).

And of course T56140: Move TemplateData to its own JSON-content namespace and associate with Template-namespace, or to its own TemplateData content model and revision slot – which I'd say is the ideal solution. And is quite feasible to implement.

Ltrlg added a subscriber: Ltrlg.May 20 2015, 5:18 PM
Elitre added a subscriber: Elitre.May 22 2015, 11:41 AM
ellif added a subscriber: ellif.Aug 8 2015, 1:10 PM

I think we have simple way to filter out subpages of templates.

eranroz added a subscriber: eranroz.Aug 8 2015, 1:14 PM

Another option: instead of filtering, use sorting by usage (group by on templatelinks) instead of alphabetic sorting.

Suggestion: allow the wiki administrator to designate a particular subpage string, such as doc, as the official place to keep TemplateData. Then VisualEditor can intelligently and unambiguously filter these pages out. See T125222.

Suggestion: allow the wiki administrator to designate a particular subpage string, such as doc, as the official place to keep TemplateData. Then VisualEditor can intelligently and unambiguously filter these pages out. See T125222.

This one could work! On pt-wiki we use "doc" as the documentation subpage and "dados" as the TemplateData. Maybe blacklisting both of them could help VisualEditor interpreting them as not templates to be transcluded.
I don't think that "excluding all subpages except those explicitly marked as templates" would be a good idea, because there are plenty of templates (Info/Patologia, Info/Grupo étnico, Info/Facção de conflito etc.) located on subpages.

Krinkle removed a subscriber: Krinkle.Nov 16 2016, 11:49 PM
Magol added a subscriber: Magol.Dec 28 2017, 11:22 AM

An example: I accidentally {{Nemzetközi katalógusok/doc}} instead of {{Nemzetközi katalógusok}}, because I was not thoughtful enough. We should find a way to avoid the problem.

stjn added a subscriber: stjn.Jul 15 2018, 12:05 AM

Suggestion: allow the wiki administrator to designate a particular subpage string, such as doc, as the official place to keep TemplateData. Then VisualEditor can intelligently and unambiguously filter these pages out. See T125222.

(This is an old comment but I think it would be helpful.) TemplateData already has a message for this in the configuration, MediaWiki:Templatedata-doc-subpage, so implementing solutions based on that shouldn’t be a problem.

Change 464718 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/TemplateData@master] Don't store templatedata pageprop on doc-subpage

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

Change 464718 merged by jenkins-bot:
[mediawiki/extensions/TemplateData@master] Don't store templatedata pageprop on doc-subpage

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

Elitre removed a subscriber: Elitre.Nov 8 2018, 5:03 PM

Change 483205 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] MWTemplateTitleInputWidget: Filter out templates named '…/doc'

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

@Jdforrester-WMF, how this would be deployed? How your change will identify language variants for /doc?

@Jdforrester-WMF, how this would be deployed? How your change will identify language variants for /doc?

It'd be a train patch. Communities already (can) define the template documentation sub-page for the TemplateData extension via the templatedata-doc-subpage message, and this just re-uses that, which defaults to foo (so if you create Template:Foo/doc it'll be hidden, but Template:Foo/I have another sub-page to be confusing won't). Not merged yet though. I don't think this'd be worth a Tech News post.

Trizek-WMF added a project: User-notice.EditedJan 15 2019, 2:18 PM

Thanks!
I think it worth a Tech News post since some communities may see the difference. It is a good opportunity to highlight templatedata-doc-subpage too is not already known.

Johan added a subscriber: Johan.Jan 17 2019, 4:47 PM

Is this done and will be deployed next week? (It's been added to Tech News.) I can't see that in the task, but I could be missing something?

Is this done and will be deployed next week? (It's been added to Tech News.) I can't see that in the task, but I could be missing something?

Nope, sorry, code still going through review. I'll go poke it now.

matmarex moved this task from Incoming to QA on the VisualEditor (Current work) board.

Change 483205 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] MWTemplateTitleInputWidget: Filter out templates named '…/doc'

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

Esanders moved this task from Inbox to Low Priority on the Editing QA board.Feb 7 2019, 7:07 PM
ppelberg closed this task as Resolved.May 10 2019, 1:18 AM
ppelberg claimed this task.