Page MenuHomePhabricator

Trim selections with <span>-wrapped whitespace on the start/end when creating a link
Closed, ResolvedPublic8 Estimated Story Points

Description

Very similar to T53023 but for internal links.

Please prevent VE from creating links like [[1970|1970 ]], this makes ugly wikitext which is lot more difficult to maintain than necessary.

Exemple of edit with multiple links like that created:
https://fr.wikipedia.org/w/index.php?title=Anne_Delb%C3%A9e&diff=next&oldid=112773998

Event Timeline

NicoV created this task.Mar 16 2015, 8:49 PM
NicoV raised the priority of this task from to Needs Triage.
NicoV updated the task description. (Show Details)
NicoV added a subscriber: NicoV.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 16 2015, 8:49 PM
Elitre added a subscriber: Elitre.Mar 18 2015, 1:04 PM
Jdforrester-WMF triaged this task as Medium priority.Mar 19 2015, 2:27 AM
Jdforrester-WMF set Security to None.
Jdforrester-WMF edited a custom field.

We already trim whitespace from the start and end of selection when creating a new link annotation (and any other kind of annotation, too). If you really mean to include whitespace in it, you modify the annotation after inserting it.

But this is a different issue. Here's the Parsoid HTML corresponding to * 1970 : ''Les Camisards'' de René Allio in the source:

<ul data-parsoid='{"dsr":[7717,8284,0,0]}'><li data-parsoid='{"dsr":[7717,7757,1,0]}'> 1970<span typeof="mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true,"dsr":[7723,7724,null,0]}'> </span>: <i data-parsoid='{"dsr":[7726,7743,2,2]}'>Les Camisards</i> de René Allio</li>

The <span typeof="mw:Placeholder"> gets alienated in VE and thus is not treated as whitespace. Perhaps we should handle in it VE, or perhaps Parsoid should stop emitting those ("isDisplayHack":true indeed). This seems related to the "French spaces" feature in the PHP parser, where it converts : (and similar) to &nbsp;: in order to prevent incorrect line breaking in correctly punctuated French-language text. (This is applied in all languages nevertheless.)

Jdforrester-WMF renamed this task from Trim selections with whitespace on the end when creating a link to Trim selections with <span>-wrapped whitespace on the start/end when creating a link.Mar 24 2015, 5:40 PM
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Given these don't occur in the English Wikipedia, I'll drop this from Q3 goals and move to Q4.

Affects spaces preceding ?, :, ;, ! and %, and around guillemet quotes, which are all indeed rare and usually incorrect in other languages.

Jdforrester-WMF closed this task as Resolved.Jun 16 2015, 10:28 PM
Jdforrester-WMF claimed this task.

Thanks to changes in Parsoid this is now no longer an issue, I believe.