Page MenuHomePhabricator

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

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

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.

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).

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 Medium priority.Nov 17 2016, 11:10 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 Needs Investigation to Bugs & Crashers on the Parsoid board.