Comment syntax shown in template's name in VisualEditor
Open, LowPublic

Description

Comment syntax is shown in template's name in VisualEditor if a comment is included in the template invocation in wikitext.

Example: https://en.wikipedia.org/wiki/Skyfall#Box_office has a {{multiple image}} template included as such:

{{multiple image
<!-- Essential parameters -->
| align     = left
| direction = vertical
…
}}

When that article is opened for editing in VisualEditor, the name of the template in the context menu is shown as "multiple image <!-- Essential parameters -->". (The template can be edited and the changes saved just fine, and the dialog correctly has "Multiple image" in the header, so this is presumably a VE and not a Parsoid issue.)

The dialog also has other comments inside that appear in the fields for template values, but that falls under T52355 I suppose.

matmarex created this task.Feb 15 2015, 7:31 PM
matmarex updated the task description. (Show Details)
matmarex raised the priority of this task from to Needs Triage.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 15 2015, 7:31 PM
Jdforrester-WMF triaged this task as Low priority.
Jdforrester-WMF set Security to None.
coren awarded a token.Feb 5 2016, 5:45 PM

So, T150468 appears to be related, and it's in Content Translation and not really VE, so maybe it is in Parsoid?

So, T150468 appears to be related, and it's in Content Translation and not really VE, so maybe it is in Parsoid?

This is invalid wikitext, and Parsoid is trying its best. Mostly I think we should get users to not try to break the wikis. :-)

Amire80 added subscribers: ssastry, Arlolra.

So, T150468 appears to be related, and it's in Content Translation and not really VE, so maybe it is in Parsoid?

This is invalid wikitext, and Parsoid is trying its best. Mostly I think we should get users to not try to break the wikis. :-)

This appears to be good enough for page rendering, so it looks like at the moment the users don't notice that it's invalid. I also cannot find that it's invalid in parser tests. Is it documented anywhere?

I'm fine with suggesting users to get rid of instances of such comments with a bot or something along these lines, but it should be at least based on parser documentation.

cscott added a subscriber: cscott.Nov 11 2016, 5:20 PM

There's not really a "spec" for wikitext, of course: https://lists.wikimedia.org/pipermail/wikimedia-l/2016-November/085415.html

@Amire80 found a relevant parser test, and added a clause for the PHP parser: https://gerrit.wikimedia.org/r/320973

The relevant fragment of parsoid output from the parser test is:

"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"

which is as it should be: we parse it correctly as an invocation of Template:Echo, and provide the raw wikitext (including all relevant whitespace or non-semantic content).

VisualEditor should probably use the href field here in its context menu, not the wt field; this seems like a VE UI bug. Once you open the template for editing, perhaps you'd want to be able to edit the raw wikitext, but the href field is more appropriate in terms of showing the user which template is represented.

Change 320973 had a related patch set uploaded (by C. Scott Ananian):
Add !!html/php parser test for HTML comment after template name

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

Change 320973 merged by jenkins-bot:
Add !!html/php parser test for HTML comment after template name

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