Subramanya Sastry has uploaded a new change for review. ( 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, 7 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/14/403314/1 diff --git a/lib/html2wt/DOMHandlers.js b/lib/html2wt/DOMHandlers.js index d6984a4..927ab0c 100644 --- a/lib/html2wt/DOMHandlers.js +++ b/lib/html2wt/DOMHandlers.js @@ -1493,6 +1493,10 @@ } return p.then(function(s) { state.singleLineContext.disable(); + // FIXME: Ugh! + 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..7a07bf3 100644 --- a/lib/wt2html/pp/processors/wrapSections.js +++ b/lib/wt2html/pp/processors/wrapSections.js @@ -230,7 +230,7 @@ if (/mw:Transclusion/.test(tplInfo.first.getAttribute('typeof'))) { dmw.parts.push(state.getSrc(tplEndOffset, newTplEndOffset)); } else { /* Extension */ - dmw.body.extsrc += state.getSrc(tplEndOffset, newTplEndOffset); + dmw.extSuffix = state.getSrc(tplEndOffset, newTplEndOffset); } // Update DSR tplDsr[1] = newTplEndOffset; @@ -281,7 +281,8 @@ // 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); + 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: newchange Gerrit-Change-Id: I9cef92966fb9acd8262237884ae8ec7acfe9cdcc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits