[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: CX1: Check for template adaptation failures before publishing

2017-11-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
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(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: Ib6d058eac4957803f563fc1333c147719ee5ad1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: KartikMistry 
Gerrit-Reviewer: Nikerabbit 
Gerrit-Reviewer: Santhosh 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ContentTranslation[master]: CX1: Check for template adaptation failures before publishing

2017-11-01 Thread Santhosh (Code Review)
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 

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