Page MenuHomePhabricator

Editing a template with VE adds a space after text
Open, NormalPublic

Description

When editing a template parameter using VE, the editor adds text between the "=" and the space.
For example, if we have

Vertical			Horizontal
{{Template		{{Template
|param1 =		|param1 = |param2 = |param3 = 
|param2 =		}}
|param3 = 
}}

VE shoud write this:

Vertical			Horizontal
{{Template		{{Template
|param1 = text		|param1 = text|param2 = text|param3 = text
|param2 = text		}}
|param3 = text
}}

But, in fact, the actual edit is this:

Vertical			Horizontal
{{Template		{{Template
|param1 =text		|param1 =text |param2 =text |param3 =text 
|param2 =text		}}
|param3 =text 
}}

Event Timeline

Nnvu created this task.Mar 15 2016, 8:04 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 15 2016, 8:04 PM
Nnvu added a subscriber: Elitre.Mar 15 2016, 8:12 PM
Nnvu removed a subscriber: Nnvu.Mar 17 2016, 3:36 PM
Nnvu added a subscriber: Nnvu.
Nnvu updated the task description. (Show Details)Apr 24 2016, 11:11 AM

I don't understand this ... What is the horizontal / vertical thing here? Can you give me a sample edit where the output is problematic? Separately, note that Parsoid's output is determined by TemplateData information about whether the translcusions for the template should use inline or block formatting.

Nnvu updated the task description. (Show Details)Jul 20 2016, 9:34 AM
Nnvu added a comment.Jul 20 2016, 9:40 AM

Hi, sorry for the late answer, but I don't recive phab emails anymore.

The horizontal vertical thing is to explain what VE does in template codes. Before, VisualEditor didn't added a blank space between the "=" sign and the text added with the Template Editor tool. But, with a test done now, I've noticed the problem seems to be solved (see test).

Nnvu added a comment.Jul 24 2016, 8:52 AM

Me, again. So, apparently the issue is still happening. As you can see in this edit VE has added new text, but there's no space between the text and the "=" sign. Instead, the space is at the end of the text, after "2014" and "[[Florida|FL]]".

As I indicated earlier, Parsoid relies on Templatedata spec for formatting transclusions. Can you take a look at whether the templatedata spec existed for the template used there?

ssastry triaged this task as Normal priority.Nov 17 2016, 11:10 PM
ssastry added a subscriber: cscott.Nov 18 2016, 4:57 PM

Hmm .. okay. I suppose this existed at the time that edit happened. I'll take a look next week. (@cscott FYI.)

Okay, I know what is going on here. Since the transclusion already had a prior empty parameter (|Didascalia =), Parsoid records that there is no parameter and it has no spaces after the "=". Since Parsoid generates pre-recorded whitespace (to prevent unnecessary dirty diffs), it doesn't emit any space after the "=" char. You can verify by editing the transclusion on that page and add a missing parameter vs. editing a parameter that has no value. The newly added parameter gets the right spaces.

Anyway, this is an edge case inside Parsoid. We should probably add some special case code for parameters that are present in the source, but are empty.

ssastry moved this task from Backlog to html2wt on the Parsoid board.Dec 18 2017, 9:48 PM