jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/374526 )
Change subject: Reference: Remove wrapping of reference body ...................................................................... Reference: Remove wrapping of reference body Change-Id: I5c1e60176b54095773c429c8e47c9c923552e2a1 --- M lib/translationunits/MWReference.js 1 file changed, 5 insertions(+), 8 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified Nikerabbit: Looks good to me, approved diff --git a/lib/translationunits/MWReference.js b/lib/translationunits/MWReference.js index ff0294c..4e74580 100644 --- a/lib/translationunits/MWReference.js +++ b/lib/translationunits/MWReference.js @@ -14,7 +14,7 @@ class MWReference extends TranslationUnit {} MWReference.prototype.adapt = cxutil.async( function* () { - let refData, refBody, wrappedRefBody, translatedRefBody, unwrappedTranslatedRefBody; + let refData; // TODO: This format is not decided yet. We do need to inform client about failed // adaptations somehow. @@ -35,22 +35,19 @@ return this.node; } - refBody = refData.body && refData.body.html; + let refBody = refData.body && refData.body.html; if ( !refBody ) { this.log( 'debug', 'Not-adapting a reference node without data-mw.body.html: ' + this.node.attributes.id ); return this.node; } - // MTClient only accepts content wrapped in block element tags in HTML mode. - wrappedRefBody = '<div>' + refBody + '</div>'; // TODO: Parse recursively instead of just MTing to handle templates // Translate reference contents - translatedRefBody = yield this.context.conf.mtClient.translate( - this.sourceLanguage, this.targetLanguage, wrappedRefBody + let translatedRefBody = yield this.context.conf.mtClient.translate( + this.sourceLanguage, this.targetLanguage, refBody ); - unwrappedTranslatedRefBody = translatedRefBody.replace( /^<div>(.*)<\/div>$/, '$1' ); - refData.body.html = unwrappedTranslatedRefBody; + refData.body.html = translatedRefBody; this.node.attributes[ 'data-mw' ] = JSON.stringify( refData ); this.node.attributes[ 'data-cx' ] = JSON.stringify( { adapted: true -- To view, visit https://gerrit.wikimedia.org/r/374526 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5c1e60176b54095773c429c8e47c9c923552e2a1 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/services/cxserver Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Catrope <r...@wikimedia.org> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits