Page MenuHomePhabricator

Conversion error for leading whitespaces in pararaph and indent-pre suppressing contexts
Closed, ResolvedPublic

Description

When converting the following wikitext to HTML (and also back to Wikitext) the
leading spaces beginning from the second line are stripped.

Steps to reproduce

Input:

<li>
 foo
 bar
</li>

Output:

$ node bin/parse.js < example.wikitext
[warn/dsr/inconsistent][enwiki/Main Page] DSR inconsistency: cs/s mismatch for node LI s: 4 ; cs 5
[..]
<li>
 foo
bar
</li>

Back to wikitext:

<li>
 foo
bar
</li>

Expected outcome

Both the generated HTML and Wikitext preserve all leading spaces.

Actual outcome

Beginning from the second line one level of leading spaces is stripped.

More information

The same happens with dd tags, probably all tags which suppress both paragraph wrapping and indent-pre generation.

Tested with v0.11.0 and v0.12.0-a17 both JS and PHP implementations.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 18 2020, 7:28 AM
ssastry triaged this task as Medium priority.Jun 18 2020, 4:40 PM
ssastry removed a project: Parsoid.
ssastry moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.
ssastry added a project: Parsoid.
ssastry lowered the priority of this task from Medium to Low.Jun 18 2020, 4:42 PM
ssastry added a subscriber: ssastry.

This is a bug in the paragraph wrapper where it reconverts <pre> .. </pre> inside block tags back to non-pre lines with a " " added back. But, it is only adding it back to the first line. Given that this bug has been around for ever, and only reported now, clearly, this usage is uncommon.

Change 606523 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Preserving leading whitespace in indent-pre suppressing contexts

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

Aklapper removed a subscriber: Parsoid.Jun 19 2020, 12:52 PM

Change 606523 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Preserving leading whitespace in indent-pre suppressing contexts

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

Arlolra closed this task as Resolved.Jun 22 2020, 10:02 PM
Arlolra claimed this task.

Change 608437 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump Parsoid to v0.12.0-a19

https://gerrit.wikimedia.org/r/c/mediawiki/vendor/ /608437

Change 608437 merged by jenkins-bot:
[mediawiki/vendor@master] Bump Parsoid to v0.12.0-a19

https://gerrit.wikimedia.org/r/c/mediawiki/vendor/ /608437