[MediaWiki-commits] [Gerrit] Make sure image caption is always at the end of image parame... - change (mediawiki...BlueSpiceExtensions)

2015-03-10 Thread Mglaser (Code Review)
Mglaser has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/195557

Change subject: Make sure image caption is always at the end of image parameters
..

Make sure image caption is always at the end of image parameters

Image caption should always be at the end of an image link

Change-Id: I78360d2977a6255ad9c382931aeb13e6a5bcc8af
---
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/57/195557/1

diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js 
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index 651e92a..f6595ce 100644
--- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
+++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
@@ -341,7 +341,7 @@
 
for (var i = 0; i  images.length; i++) {
var image, htmlImageObject, wikiImageObject,
-   attributes, attribute, wikiText,
+   attributes, attribute, wikiText, imageCaption,
size, property, value;
 
image = images[i];
@@ -405,6 +405,7 @@
 
// Build wikitext
wikiText = [];
+   imageCaption = false;
wikiText.push(wikiImageObject.imagename);
for (property in wikiImageObject) {
if ($.inArray(property, ['imagename', 
'thumbsize']) !== -1) {
@@ -444,8 +445,12 @@
wikiText.push(property + '=' + value);
continue;
}
-   if ($.inArray(property, ['caption', 'align']) 
!== -1) {
+   if ( property == 'align' ) {
wikiText.push(value);
+   continue;
+   }
+   if ( property == 'caption' ) {
+   imageCaption = value;
continue;
}
if (value === true) {
@@ -453,6 +458,11 @@
}
}
 
+   // make sure image caption comes in the end
+   if ( imageCaption ) {
+   wikiText.push( imageCaption );
+   }
+
text = text.replace(image, '[[' + 
wikiText.join('|').replace(@@PIPE@@, '|') + ']]');
}
return text;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78360d2977a6255ad9c382931aeb13e6a5bcc8af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser gla...@hallowelt.biz

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


[MediaWiki-commits] [Gerrit] Make sure image caption is always at the end of image parame... - change (mediawiki...BlueSpiceExtensions)

2015-03-10 Thread Robert Vogel (Code Review)
Robert Vogel has submitted this change and it was merged.

Change subject: Make sure image caption is always at the end of image parameters
..


Make sure image caption is always at the end of image parameters

Image caption should always be at the end of an image link

Change-Id: I78360d2977a6255ad9c382931aeb13e6a5bcc8af
---
M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Robert Vogel: Verified; Looks good to me, approved



diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js 
b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
index 651e92a..f6595ce 100644
--- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
+++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js
@@ -341,7 +341,7 @@
 
for (var i = 0; i  images.length; i++) {
var image, htmlImageObject, wikiImageObject,
-   attributes, attribute, wikiText,
+   attributes, attribute, wikiText, imageCaption,
size, property, value;
 
image = images[i];
@@ -405,6 +405,7 @@
 
// Build wikitext
wikiText = [];
+   imageCaption = false;
wikiText.push(wikiImageObject.imagename);
for (property in wikiImageObject) {
if ($.inArray(property, ['imagename', 
'thumbsize']) !== -1) {
@@ -444,8 +445,12 @@
wikiText.push(property + '=' + value);
continue;
}
-   if ($.inArray(property, ['caption', 'align']) 
!== -1) {
+   if ( property == 'align' ) {
wikiText.push(value);
+   continue;
+   }
+   if ( property == 'caption' ) {
+   imageCaption = value;
continue;
}
if (value === true) {
@@ -453,6 +458,11 @@
}
}
 
+   // make sure image caption comes in the end
+   if ( imageCaption ) {
+   wikiText.push( imageCaption );
+   }
+
text = text.replace(image, '[[' + 
wikiText.join('|').replace(@@PIPE@@, '|') + ']]');
}
return text;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I78360d2977a6255ad9c382931aeb13e6a5bcc8af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser gla...@hallowelt.biz
Gerrit-Reviewer: Pigpen reym...@hallowelt.biz
Gerrit-Reviewer: Robert Vogel vo...@hallowelt.biz
Gerrit-Reviewer: jenkins-bot 

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