Page MenuHomePhabricator

VisualEditor: When editing a template, the title is truncated at first dot (period)
Closed, ResolvedPublic

Description

  1. Edit [[mw:API:Meta]] in VisualEditor
  2. Select the "MediaWiki version 1.8" template

A popup appears showing the template's correct name ("MW 1.8").

  1. Open the transclusion editor for the template

VE thinks it is editing a template called "MW 1".

Also note that when you try to insert a template with a period in its name, like "MW 1.8", you get a whole lot of suggestions for "MW 1".


Version: unspecified
Severity: minor

Details

Reference
bz66939

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:29 AM
bzimport set Reference to bz66939.

I blame mwTitle. Because it's always at fault.

Yep.

mw.Title.newFromText( 'Template:Asd.com' ).getNameText()
"Asd"

getNameText() explicitly leaves out any faux extension. That's by design. To get the page title, use getMainText.

https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Title-method-getNameText

btw, This is a compatibility/legacy left-over from when mw.Title was part of UploadWizard and they got dibs on the more intuitive name "getNameText". Unfortunately this mistake was not uncovered until after it was merged in mediawiki-core and released in an LTS.

Yeah, I worked that out soon after moving the bug.

Still, I wonder if the documentation should be improved for those methods.

Change 142372 had a related patch set uploaded by Alex Monk:
Don't remove 'extension' from template names

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

Change 142372 merged by jenkins-bot:
Don't remove 'extension' from template names

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