GWicke has submitted this change and it was merged.
Change subject: Fixed serializer to use dsr info to emit syntactic whitespace.
......................................................................
Fixed serializer to use dsr info to emit syntactic whitespace.
Change summary
--------------
* Serializer can now be run with/without original wikitext source.
Added --oldtext and --oldtextfile (copied from selser mode) to pass
original text to the serializer.
* Before serializing, DOM is normalized to eliminate syntactic
whitespace (with original source) or newlines (without original
source).
* Separators are emitted separately in serializeDOM -- space before
current node and first child, space between children, space between
last child and node.
* List handler fixed up to emit newlines between list items rather than
include them within the list item.
* Fixed getDOMRange to add empty spans only when needed -- subtle bug.
* Changed DSR computation to associated 1 char with <br/> nodes
and fixed paragraph wrapper to emit syntactic newlines to keep
dsr computations unchanged.
* Deleted unneeded normalizeWhitespace dom-post-processor pass.
* Added migrateTrailingNLs dom-post-processor pass to move trailing
nls out of dom-nodes that end lines in wikitext so that they can be
emitted as separators during serialization.
* Replaced all outerHTML calls with innerHTML calls in DOMPostProcessor.
Parser tests summary
--------------------
* Added --use_source parser tests mode to run wt2wt tests with/without
original wikitext passed to the serializer.
* 697 wt2wt tests pass without original source passed in;
785 wt2wt tests pass when original source is passed in.
786 used to pass before the refactor.
(+1 and -2 for a net of -1 since refactoring)
* one failure because of use of newline as semantic list separator
fixing this requires inserting a meta-tag possible instead of the
newline.
* one failure because of missing dsr[0] value on a mw:Entity which
leads to loss of a single whitespace char before the entity.
* 2 additional wt2html tests passing.
* 478 html2html tests now passing (instead of 457 on master).
Change-Id: I7dfb1b796021073afd80b6891cdb48469cc2cbde
---
M js/lib/ext.core.ListHandler.js
M js/lib/ext.core.ParagraphWrapper.js
M js/lib/mediawiki.DOMPostProcessor.js
M js/lib/mediawiki.WikitextSerializer.js
M js/tests/parse.js
M js/tests/parserTests.js
6 files changed, 454 insertions(+), 252 deletions(-)
Approvals:
GWicke: Verified; Looks good to me, approved
jenkins-bot: Checked
--
To view, visit https://gerrit.wikimedia.org/r/42041
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7dfb1b796021073afd80b6891cdb48469cc2cbde
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: serializer-refactoring
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits