jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/403314 )
Change subject: Improve handling of section-wrapping and extcontent boundary conflicts ...................................................................... Improve handling of section-wrapping and extcontent boundary conflicts 1. We mistakenly assumed presence of dataMW.body.extsrc for all extensions. 2. Expanding template source to include toplevel content was not the right thing to do for all extensions -- it might be okay for the translate extension which was the primary source of these conflicts according to 5c4f0f5b. Deal with both scenarios properly by adding additional prefix/suffix properties to data-mw.body for section tags that swallow other content surrounding extension content and get extension markers added to them. This required updating html2wt to handle the prefix/suffix text properly - otherwise, those will be lost in html2wt (since the content could have been marked extension affected). Ex: https://fr.wikisource.org/wiki/Clair_de_lune_(Leopold_von_Sacher-Masoch) Change-Id: I9cef92966fb9acd8262237884ae8ec7acfe9cdcc --- M lib/html2wt/DOMHandlers.js M lib/wt2html/pp/processors/wrapSections.js 2 files changed, 9 insertions(+), 2 deletions(-) Approvals: C. Scott Ananian: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/html2wt/DOMHandlers.js b/lib/html2wt/DOMHandlers.js index d6984a4..5173126 100644 --- a/lib/html2wt/DOMHandlers.js +++ b/lib/html2wt/DOMHandlers.js @@ -1493,6 +1493,10 @@ } return p.then(function(s) { state.singleLineContext.disable(); + // FIXME: https://phabricator.wikimedia.org/T184779 + if (dataMw.extPrefix || dataMw.extSuffix) { + s = (dataMw.extPrefix || '') + s + (dataMw.extSuffix || ''); + } self.emitWikitext(handleListPrefix(node, state) + s, node); state.singleLineContext.pop(); return DU.skipOverEncapsulatedContent(node); diff --git a/lib/wt2html/pp/processors/wrapSections.js b/lib/wt2html/pp/processors/wrapSections.js index 2f5d315..35de963 100644 --- a/lib/wt2html/pp/processors/wrapSections.js +++ b/lib/wt2html/pp/processors/wrapSections.js @@ -230,7 +230,8 @@ if (/mw:Transclusion/.test(tplInfo.first.getAttribute('typeof'))) { dmw.parts.push(state.getSrc(tplEndOffset, newTplEndOffset)); } else { /* Extension */ - dmw.body.extsrc += state.getSrc(tplEndOffset, newTplEndOffset); + // https://phabricator.wikimedia.org/T184779 + dmw.extSuffix = state.getSrc(tplEndOffset, newTplEndOffset); } // Update DSR tplDsr[1] = newTplEndOffset; @@ -281,7 +282,9 @@ // the transclusion and eliminates dirty-diffs. DU.setDataParsoid(newS1, { pi: tplDP.pi, dsr: [ dsr1, dsr2 ] }); } else { /* extension */ - dmw.body.extsrc = state.getSrc(dsr1, tplDsr[0]) + dmw.body.extsrc + state.getSrc(tplDsr[1], dsr2); + // https://phabricator.wikimedia.org/T184779 + dmw.extPrefix = state.getSrc(dsr1, tplDsr[0]); + dmw.extSuffix = state.getSrc(tplDsr[1], dsr2); DU.setDataMw(newS1, dmw); newS1.setAttribute('typeof', tplInfo.first.getAttribute('typeof')); DU.setDataParsoid(newS1, { dsr: [ dsr1, dsr2 ] }); -- To view, visit https://gerrit.wikimedia.org/r/403314 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9cef92966fb9acd8262237884ae8ec7acfe9cdcc Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <[email protected]> Gerrit-Reviewer: Arlolra <[email protected]> Gerrit-Reviewer: C. Scott Ananian <[email protected]> Gerrit-Reviewer: Sbailey <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
