Page MenuHomePhabricator

When inserting new content before headings, insert an extra newline for WT readability
Closed, ResolvedPublic

Description

Heading constraints could use tweaking to make sure that content before existing headings leaves an extra newline for readability even though the heading is not a new heading. We already serialize newly inserted headings correctly. Discovered by looking at serialized output of the [[mw:Parsoid/Deployments]] page.

See shell session below that shows the problem.

[subbu@earth tests] echo "==A==\na" > /tmp/wt
[subbu@earth tests] node parse < /tmp/wt > /tmp/old.html
[subbu@earth tests] sed 's/<h2>/<h2>NEW<\/h2>\n<p>new<\/p>\n<h2>/g;' < /tmp/old.html > /tmp/new.html
[subbu@earth tests] node parse --html2wt < /tmp/new.html
==A==
a
[subbu@earth tests] sed 's/<h2/<h2>NEW<\/h2>\n<p>new<\/p>\n<h2/g;' < /tmp/old.html > /tmp/new.html
[subbu@earth tests] node parse --html2wt < /tmp/new.html
== NEW ==
new
==A==
a
[subbu@earth tests] node parse --selser --oldhtmlfile /tmp/old.html --oldtextfile /tmp/wt < /tmp/new.html
== NEW ==
new
==A==
a
[subbu@earth tests] echo "<h2>y</h2>\n<p>bar</p>\n<h2>x</h2>\n<p>foo</p>\n<h2>boo</h2>\n<p>bar</p>" | node parse --html2wt
== y ==
bar

== x ==
foo

== boo ==
bar

Version: unspecified
Severity: normal

Details

Reference
bz70791