Last modified: 2013-08-29 18:15:27 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 T53462, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51462 - VisualEditor: Strip whitespace from the start of paragraphs before sending to Parsoid
VisualEditor: Strip whitespace from the start of paragraphs before sending to...
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Data Model (Other open bugs)
unspecified
All All
: High enhancement
: VE-deploy-2013-08-15
Assigned To: Ed Sanders
:
: 51509 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-16 19:06 UTC by Oliver Keyes
Modified: 2013-08-29 18:15 UTC (History)
9 users (show)

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


Attachments

Comment 2 ssastry 2013-07-16 20:18:41 UTC
If VE can strip leading whitespace in paragraphs, that will eliminate these errors.  Alternatively, Parsoid can do that normalization. Unclear where this should be done.  Will discuss on IRC.
Comment 3 ssastry 2013-07-16 20:25:52 UTC
Without whitespace stripping (either in VE or Parsoid) and no nowiki, that text will become <pre>-formatted.

Quickly discussed with Gabriel on IRC. It is probably better fixed in VE since Parsoid doesn't have contextual information about where the space is meaningful or not.

If leading whitespace at start of line is desired by the editor, then VE should convert them to &nbsp; or if nowikis are acceptable, the spaces can be left alone.  In either case, this kind of edits should hopefully be rare.
Comment 4 ssastry 2013-07-18 17:30:15 UTC
*** Bug 51509 has been marked as a duplicate of this bug. ***
Comment 5 Ed Sanders 2013-07-30 16:25:50 UTC
With bug 50841 we now convert 

[space]Foo

to

<nowiki> </nowiki>Foo

(previously <nowiki> Foo</nowiki>)

This is the correct behaviour.

We should be careful going do the road of automatically correcting what we believe to be typos. Perhaps this, and other whitespace issues (e.g. double spaces), should be flagged up to the user (with a wiggle underline?)
Comment 6 ssastry 2013-07-30 17:02:43 UTC
*** Bug 52252 has been marked as a duplicate of this bug. ***
Comment 7 James Forrester 2013-07-30 18:14:17 UTC
(In reply to comment #5)
> With bug 50841 we now convert 
> 
> [space]Foo
> 
> to
> 
> <nowiki> </nowiki>Foo
> 
> (previously <nowiki> Foo</nowiki>)
> 
> This is the correct behaviour.

Also, with Gerrit change #76223 VisualEditor users can now edit through <nowiki>s transparently.

> Perhaps this, and other whitespace issues (e.g. double
> spaces), should be flagged up to the user (with a wiggle underline?)

That would be one solution that is quite generalisable, but could be a great deal more work.
Comment 8 Gerrit Notification Bot 2013-08-02 11:38:26 UTC
Change 77287 had a related patch set uploaded by Esanders:
[WIP] Remove inserted leading whitepsace

https://gerrit.wikimedia.org/r/77287
Comment 9 Ed Sanders 2013-08-02 13:11:07 UTC
So I just implemented a fix for this, but it broke a test that asserts that whitespace inside a pre is untouched. I'll put it a check for <pre> elements but we should be aware that this is broken, because any element can have white-space:pre attached to it, e.g.

<span style="white-space:pre">    Foo</span>

Will now normalise to

<span style="white-space:pre">Foo</span>

Long term we should look into just warning the user.
Comment 10 Gerrit Notification Bot 2013-08-02 19:03:53 UTC
Change 77287 merged by jenkins-bot:
Remove inserted leading whitespace

https://gerrit.wikimedia.org/r/77287
Comment 11 James Forrester 2013-08-02 20:27:23 UTC
Now fixed in the code; next scheduled deployment is not until 15 August,
however. :-(
Comment 12 Elitre 2013-08-29 10:01:19 UTC
Reopening as this is still happening:
first nowiki after line 133 in https://en.wikipedia.org/w/index.php?title=Pet&diff=570614739&oldid=570586939 .
Comment 13 Elitre 2013-08-29 10:41:59 UTC
I am also filing a related common problem we meet at it.wp.
If this is not the right place, just tell me and I'll copy/paste my report elsewhere.

We had troubles with nowikis being thrown right after some templates when the user did not add an extra space there, but simply edited something in that page. See https://it.wikipedia.org/w/index.php?title=Wikipedia&diff=61171396&oldid=61171228 .

We actually found a workaround for this: https://it.wikipedia.org/w/index.php?title=Template:Quote&curid=224372&diff=61173726&oldid=60749506 but since this addition is apparently a nonsense, users demand that VE prevents that behaviour instead.

They also think this is related to templates featuring some kind of table.

I did some tests as well.
I was able to reproduce an unwanted situation where the first line and the table (which is actually a template) were mingled in a non-editable block https://it.wikipedia.org/w/index.php?title=Utente%3AElitre_%28WMF%29%2FSandbox_VE&diff=61181542&oldid=61181524 .

But I was also able to avoid nowikis, even if the extra span tags were not added to the template: as you can see here https://it.wikipedia.org/w/index.php?title=Utente:Elitre_(WMF)/Sandbox_VE&diff=prev&oldid=61181473, if the first letter of the line is actually closer to the template's final brace (with no space between), VEditing that page will result in the text getting automatically placed in a better position, and no nowikis in sight, even after multiple saves of the page.

Thanks.
Comment 14 James Forrester 2013-08-29 18:15:27 UTC
(In reply to comment #12)
> Reopening as this is still happening:
> first nowiki after line 133 in
> https://en.wikipedia.org/w/index.
> php?title=Pet&diff=570614739&oldid=570586939 .

That's almost certainly using a cached version of the code; I can't reproduce that on Chrome/Firefox/Safari/Opera on Mac or Linux.

(In reply to comment #13)
> I am also filing a related common problem we meet at it.wp.
> If this is not the right place, just tell me and I'll copy/paste my report
> elsewhere.

Yeah, if you could file this as a new bug please - this is not related to removing whitespace from the start of paragraphs.

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


Navigation
Links