Santhosh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387783 )

Change subject: CX1: Check for template adaptation failures before publishing
......................................................................

CX1: Check for template adaptation failures before publishing

Remove typeof=mw:Transclusion if the element is invalid - without
data-mw.

Parsoid can not serialize mw:Transclusion without data-mw. Ideally
we should not have this kind of content. But bugs had caused this
and prevented publishing translations. Remove typeof attribute
so that publishing can proceed.

Bug: T154116
Change-Id: Ib6d058eac4957803f563fc1333c147719ee5ad1e
---
M modules/publish/ext.cx.publish.js
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/83/387783/1

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index f3eb7e1..6855f0e 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -355,6 +355,17 @@
                                return $( this ).html();
                        } );
 
+                       // Parsoid can not serialize mw:Transclusion without 
data-mw. Ideally we should not
+                       // have this kind of content. But bugs had caused this 
and prevented publishing
+                       // translations. See T154116. Remove typeof attribute 
so that publishing can proceed.
+                       $section.find( '[typeof*="mw:Transclusion"]' 
).replaceWith( function () {
+                               if ( !$( this ).attr( 'data-mw' ) ) {
+                                       mw.log( '[CX] Warning: Transclusion 
without data-mw. Removing typeof attribute' );
+                                       return $( this ).removeAttr( 'typeof' );
+                               }
+                               return this;
+                       } );
+
                        // Remove empty sections
                        if ( !$.trim( $section.text() ) && 
!$section.children().length ) {
                                $section.remove();

-- 
To view, visit https://gerrit.wikimedia.org/r/387783
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6d058eac4957803f563fc1333c147719ee5ad1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to