Last modified: 2014-10-30 18:39:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69657, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67657 - In HTML+RDFa DOM, make the 'params' block give a 'normalised' version of the parameter name (like done for template)
In HTML+RDFa DOM, make the 'params' block give a 'normalised' version of the ...
Status: RESOLVED FIXED
Product: Parsoid
Classification: Unclassified
DOM (Other open bugs)
unspecified
All All
: Low enhancement
: ---
Assigned To: Marc Ordinas i Llopis
:
Depends on:
Blocks: 72771
  Show dependency treegraph
 
Reported: 2014-07-08 05:33 UTC by Keegan Peterzell
Modified: 2014-10-30 18:39 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Screenshot of bug. (145.90 KB, image/png)
2014-07-09 19:58 UTC, Krinkle
Details

Description Keegan Peterzell 2014-07-08 05:33:31 UTC
Copied from my Russian Wikipedia talk page: https://ru.wikipedia.org/wiki/%D0%9E%D0%B1%D1%81%D1%83%D0%B6%D0%B4%D0%B5%D0%BD%D0%B8%D0%B5_%D1%83%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%D0%B0:Keegan_(WMF)#Bug_report_11

I filled TemplateData for Шаблон:Малая планета

early, template with comments inserted in articles
{{Малая планета
<!-- Основной блок -->
 | param        = 
<!-- Орбитальные характеристики -->
 | param        = 
<!-- Физические характеристики -->
 | param        = 
}}
now if i deleted comments https://ru.wikipedia.org/w/index.php?title=(87)_Сильвия&diff=64040824&oldid=62184664 then i can see parameters in VE editor
but if comments still in text then VE editor for template staying on "Загрузка..." ("Load...") and don't show parameters. sample: (25143) Итокава
Sunpriat 08:40, 6 июля 2014 (UTC)
Comment 1 Krinkle 2014-07-09 19:57:26 UTC
Hm.. it sounds like the bug report says that html comments inside TemplateData conflict with VisualEditor.

However I think this might've been a confusion in translation. I think the reported problem is that when the wikitext has html comments in the transclusion, that Parsoid/VE is including those as part of the template name.

E.g. that when invoking:

{{ Echo
| 1 <!-- One -->  = Foo
}}

That the transclusion dialog and/or Parsoid is saying there is a parameter called "! <!-- One -->", and renders that as actual text in the label for the UI.

Rephrasing bug accordingly. I think this is something that should be normalised by Parsoid as VisualEditor shouldn't need to know what html comments mean in wikitext.
Comment 2 Krinkle 2014-07-09 19:58:41 UTC
Created attachment 15885 [details]
Screenshot of bug.

Screenshot for editing the following on on https://www.mediawiki.org/wiki/VisualEditor/Basic_example_worksheet?veaction=edit

{{Wikimedia engineering project information
| name        =VisualEditor<!-- This HTML comment should not get deleted or modified. -->
| description <!-- ignored comment describing the parameter -->= Creating a visual editor for MediaWiki, other platforms and the Web at large
| logo        =VisualEditor-logo.svg
| ..
}}
Comment 3 Krinkle 2014-07-09 20:09:54 UTC
For comparison, Parsoid already strips out html comments from the template title. It should do so for parameter names as well (in addition to trimming whitespace).
Comment 4 James Forrester 2014-07-11 19:49:41 UTC
So… this is asking if Parsoid would consider making the 'params' block of their API give a 'normalised' version of the parameter name, possibly with a 'target' version as well like they do with templates' names?

E.g.:

Wikitext

> {{ec<!--Ho-->ho<!--Ha!-->|1<!--Foo!-->2=Foo}}


Current Parsoid output:

> {
> 	'parts': [ {
> 			'template': {
> 				'target': {
> 					'wt': 'ec<!--Ho-->ho<!--Ha!-->',
> 					'href': '../Template:Echo'
> 				},
> 			'params':
> 			{
> 				'1<!--Foo!-->2': {
> 					'wt': 'Foo'
> 				}
> 			},
> 			'i': 0
> 		}
> 	} ]
> }> 

Requested Parsoid output:

> {
> 	'parts': [ {
> 			'template': {
> 				'target': {
> 					'wt': 'ec<!--Ho-->ho<!--Ha!-->',
> 					'href': '../Template:Echo'
> 				},
> 			'params':
> 			{
> 				'12': {
> 					'target': '1<!--Foo!-->2',
> 					'wt': 'Foo'
> 				}
> 			},
> 			'i': 0
> 		}
> 	} ]
> }

… or similar?
Comment 5 Gerrit Notification Bot 2014-10-29 16:19:17 UTC
Change 169732 had a related patch set uploaded by Marcoil:
Bug 67657: Add normalized param names to templates

https://gerrit.wikimedia.org/r/169732
Comment 6 Marc Ordinas i Llopis 2014-10-29 16:23:16 UTC
In the patch I've uploaded, the normalized parameter name is used as the entry for the parameter info and the original parameter wikitext only appears if different, in the 'paramWt' attribute. So James' example would output as

> {
> 	'parts': [ {
> 			'template': {
> 				'target': {
> 					'wt': 'ec<!--Ho-->ho<!--Ha!-->',
> 					'href': '../Template:Echo'
> 				},
> 			'params':
> 			{
> 				'12': {
> 					'paramWt': '1<!--Foo!-->2',
> 					'wt': 'Foo'
> 				}
> 			},
> 			'i': 0
> 		}
> 	} ]
> }

Will that be enough, or should the paramWt be included for each parameter? Most of them will be the same anyway and that would increase page size a lot…
Comment 7 Roan Kattouw 2014-10-29 22:48:59 UTC
This looks fine to me. We don't really need paramWt in VE anyway, we don't really care that there was a comment in there, as long as Parsoid can preserve it when the template is edited. So with your proposed change, we wouldn't even have to change anything, because we'd just ignore (and preserve) paramWt.
Comment 8 Gabriel Wicke 2014-10-29 23:20:31 UTC
I'm not a fan of making 'wt' return something that's not the original wikitext. How will the need for a normalized name evolve with the 'html' parameter format? It's relatively straightforward to ask for .textContent.
Comment 9 Marc Ordinas i Llopis 2014-10-30 09:44:48 UTC
Gabriel, 'wt' still contains the original wikitext for the parameter value as it's always done, we're just adding a new paramWt attribute that only shows up if the original parameter name wikitext is different from the actual parameter name that would be used in expansion.

I think the example was a little confusing because the comment in the param name is the same as the param value, sorry for that. Another example, this time with html in it too:

> {{ec<!--tpl comment-->ho|unnamed param value|1<!--param name comment-->2=Param ''value''}}

> {
> 	'parts': [ {
> 			'template': {
> 				'target': {
> 					'wt': 'ec<!--tpl comment-->ho',
> 					'href': '../Template:Echo'
> 				},
> 			'params':
> 			{
> 				'1': {
> 					'wt': "unnamed param value",
>                                       'html': 'unnamed param value'
> 				}
> 			},
> 			{
> 				'12': {
> 					'paramWt': '1<!--param name comment-->2',
> 					'wt': "Param ''value''",
>                                       'html': 'Param <i>value</i>'
> 				}
> 			},
> 			'i': 0
> 		}
> 	} ]
> }

If paramWt isn't actually needed by VE, maybe we could even not output it at all in data-mw, as it's also kept in data-parsoid…
Comment 10 Gabriel Wicke 2014-10-30 15:36:47 UTC
Marc, thanks for the clarification. I think the name 'paramWT' contributed to my confusion. It sounds more like the value to me. How about 'key.wt'? That could be extended with key.html etc in the future.

We should definitely include the wikitext for the key, as there is no good way to properly handle editing otherwise. VE shouldn't just pretend that a parameter was not templated, when it was. Those comments also often contain information that the user might be interested in.
Comment 11 Gerrit Notification Bot 2014-10-30 18:21:03 UTC
Change 169732 merged by jenkins-bot:
Bug 67657: Add normalized parameter names to templates

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links