Page MenuHomePhabricator

2017 source editor trimmed whitespace inside a "source" block
Closed, ResolvedPublic

Description

See the diff, https://www.mediawiki.org/w/index.php?title=Extension:JADE&diff=prev&oldid=2865214&diffmode=source

Leading whitespace was stripped from each line of my <source> blocks.

Event Timeline

Esanders renamed this task from 2017 source editor trimmed whitespace inside a "code" block to 2017 source editor trimmed whitespace inside a "source" block.Aug 30 2018, 10:46 AM
Esanders added a project: SyntaxHighlight.
Esanders updated the task description. (Show Details)
Esanders subscribed.

Looks like this happens as soon as the document is loaded: https://www.mediawiki.org/wiki/Extension:JADE?veaction=editsource&section=8

This issue will be that we convert the line into "<p>[TAB][TAB]mycode</p>" and the visual editor converter turns leading/trailing whitespace inside a tag into a internal property - that gets restored when we convert back to HTML, although in 2017 source editor we used an optimised method for converting back to HTML.

We should disable the internal whitespace stripping in the converter when in source mode.

This fix shouldn't be too hard, and this might be a UBN, thoughts @Deskana ?

Let's take care of it, since it should be quick.

Change 456381 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Always treat whitespace as significant when converting for source mode

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

The fix is a bit hacky, I'll file some tech debt to follow-up.

Change 458490 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] [BREAKING CHANGE] Implement a SourceConverter

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

Change 458490 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] [BREAKING CHANGE] Implement a SourceConverter

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

Change 458489 had a related patch set uploaded (by Bartosz Dziewoński; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (7420443fe)

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

Change 456381 abandoned by Bartosz Dziewoński:
Always treat whitespace as significant when converting for source mode

Reason:
Superseded by https://gerrit.wikimedia.org/r/458490

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

Change 458489 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (7420443fe)

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