Page MenuHomePhabricator

Parsoid on serialisation should use the `format` field from TemplateData if available to set the whitespace formatting of new/edited transclusions
Closed, ResolvedPublic0 Estimated Story Points

Description

Per this feedback, break-lines are missing when infoboxes or categories are inserted.
For the record, I've already heard people on French Wikipedia complaining about it.

Expectation:
{{Писатель

Жанр = [[Фэнтези]]
Изображение =
Сайт =
Имя = Ричард Бейкер
Род деятельности = писатель-фантаст, гейм-дизайнер

}}

Reality:
{{Писатель | Жанр = [[Фэнтези]] | Изображение = | Сайт = | Имя = Ричард Бейкер | Род деятельности = писатель-фантаст, гейм-дизайнер}}

Event Timeline

Trizek-WMF raised the priority of this task from to Needs Triage.
Trizek-WMF updated the task description. (Show Details)
Trizek-WMF added a project: VisualEditor.
Trizek-WMF subscribed.
Esanders set Security to None.
Esanders subscribed.

Not sure how you can decide which to use. In some cases inline is much more sensible, e.g. "It is {{convert|50|km|miles}} high"

Maybe add a parameter in the templatedata?

Not possible for Parsoid to automatically know what is the right thing to do. Requires some templatedata information about serialization preferences.

Not possible for Parsoid to automatically know what is the right thing to do. Requires some templatedata information about serialization preferences.

Should we turn this into a Once-T64147-is-solved-Parsoid-should-listen-to-it?

I get an other feedback which may be related: a user expect VE to recognize where a Template is not supposed to be inserted. Like an infobox in the middle of a sentence.
If we can indicate something about serialization in a way or an other, it may be possible to choose a Template position in the text?

Jdforrester-WMF renamed this task from Break lines are missing while inserting infoboxes or categories with VisualEditor to Parsoid on serialisation should use the `format` field from TemplateData if available to set the whitespace formatting of new/edited transclusions.Oct 19 2015, 5:41 PM
Jdforrester-WMF raised the priority of this task from Low to High.
Jdforrester-WMF added a project: TemplateData.
Jdforrester-WMF edited a custom field.

Now we've (finally!) added this feature to TemplateData, it'd be great if this could be done soon-ish. https://gerrit.wikimedia.org/r/#/c/243138/13/Specification.md details the specification of what counts as the format to use.

Adding a parameter to templatedata to set preferences for formatting templates in wikitext requires having templatedata for every template. With a lot of templates still missing template data this might become a trap. Or, I would rather prefer 'block' as default than 'inline'. Without templatedata or without the parameter being set this would format the wikitext as written under Description under Expectation:. I do agree there are some cases inline use is much more preferable. My guess is that those case are small in number compared to the other case, and are more likely to already have templatedata.

This decision was made in T64147: Add an option in TemplateData to specify desired wikitext whitespace formatting of parameters and this isn't really the venue, but will reply here:

Adding a parameter to templatedata to set preferences for formatting templates in wikitext requires having templatedata for every template. With a lot of templates still missing template data this might become a trap.

I don't understand? Yes, to be useful every template needs its TemplateData to be written.

Or, I would rather prefer 'block' as default than 'inline'. Without templatedata or without the parameter being set this would format the wikitext as written under Description under Expectation:. I do agree there are some cases inline use is much more preferable. My guess is that those case are small in number compared to the other case, and are more likely to already have templatedata.

I think you're under-estimating how badly breaking this would be for the majority of uses. There are quite a few templates, especially ones inside infoboxes and succession boxes, where setting the wrong layout means they do not work. Inline is the current behaviour and only rarely has issues. This would not be the case if we reversed the default.

James,

Thanks for the reply. Typing from phone. Watching television, terror in
Paris. Romaine sees some blockers including this one.

I had an irc conversation with a Dutch user who doesn't want to be quoted.
For him ve might have been introduced to anonomous users yesterday on nl
wp.

Feel good have a nice day a good weekend. Peace love and hugs from Holland.

Ad

Change 264043 had a related patch set uploaded (by Subramanya Sastry):
WIP: Fetch and use templatedata

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

Change 264043 merged by jenkins-bot:
Fetch and use templatedata while serializing transclusions

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

https://gerrit.wikimedia.org/r/#/c/271933/ is the followup that needs to be completed before this is ready for deploy. This followup was necessitated after round trip testing revealed that the first patch introduce lots of dirty diffs for some inline-format transclusions.