jenkins-bot has submitted this change and it was merged. Change subject: For unadapted inline templates, ensure data-mw even after MT ......................................................................
For unadapted inline templates, ensure data-mw even after MT After passing through an MT engine, reference adaptation and template adaptation, an unadapted inline template can have typeof attribute as mw:Transclusion and missing data-mw. As per Parsoid, this is a HTTP 400 case and can cause the whole publishing failure. This patch make sure data-mw exists for such cases. Testcase: Translate https://he.wikipedia.org/w/index.php?oldid=19189209 to another language to which Yandex MT exist. Translate the first paragraph and try to publish. Without this patch, publishing will failure. With the patch, publishing should succeed. Bug: T152144 Change-Id: Ie404a21015879d298714a7e666513070e7a88e4a --- M modules/tools/ext.cx.tools.template.js 1 file changed, 7 insertions(+), 1 deletion(-) Approvals: Amire80: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/tools/ext.cx.tools.template.js b/modules/tools/ext.cx.tools.template.js index f41ef30..13fe349 100644 --- a/modules/tools/ext.cx.tools.template.js +++ b/modules/tools/ext.cx.tools.template.js @@ -1036,7 +1036,13 @@ if ( this.targetTemplate.options.inline ) { // just leave the template unchanged. Add a class. this.targetTemplate.$template.addClass( 'cx-unadaptable-template' ); - this.targetTemplate.$template.attr( 'data-template-state', 'keep-original' ); + // Copy the attributes explicitly since we cannot assume they are present + // after MT of parent section. + this.targetTemplate.$template.attr( { + 'data-template-state': 'keep-original', + 'data-mw': this.sourceTemplate.$template.attr( 'data-mw' ), + 'typeof': this.sourceTemplate.$template.attr( 'typeof' ) + } ); } else { $new = $( '<div>' ) .addClass( 'placeholder cx-unadaptable-template' ) -- To view, visit https://gerrit.wikimedia.org/r/325520 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie404a21015879d298714a7e666513070e7a88e4a Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits