[MediaWiki-commits] [Gerrit] mediawiki...TextExtracts[master]: Remove empty paragraphs

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Remove empty paragraphs
..

Remove empty paragraphs

When I get the intro of a Wikipedia article, sometimes I get
trailing empty paragraphs when there are none in the source.
This disturbs the layout and is unexpected, undesired behavior.

Change-Id: Ic1bcf0ff512168e9393c5c0d55b8d59e714f1baf
---
M includes/ExtractFormatter.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TextExtracts 
refs/changes/68/309068/1

diff --git a/includes/ExtractFormatter.php b/includes/ExtractFormatter.php
index 22dd787..9130663 100644
--- a/includes/ExtractFormatter.php
+++ b/includes/ExtractFormatter.php
@@ -52,6 +52,7 @@
public function getText( $dummy = null ) {
$this->filterContent();
$text = parent::getText();
+   $text = str_replace( "", '', $text ); // remove empty 
paragraphs
if ( $this->plainText ) {
$text = html_entity_decode( $text );
$text = str_replace( "\xC2\xA0", ' ', $text ); // 
replace nbsp with space

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1bcf0ff512168e9393c5c0d55b8d59e714f1baf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Rewrite extension so that images are not preloaded

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Rewrite extension so that images are not preloaded
..

Rewrite extension so that images are not preloaded

Before, all full-size images were preloaded and hidden so that when
a user hovered over a thumbnail, the corresponding full-size image
would be instantly shown. This had the huge problem of requiring to
preload all images even if no thumbnail was ever hovered. Now, images
are only loaded if a user hovers over the thumbnail.

Change-Id: I592aae7e469e6a191e436256b110f4bf0e1e5f4a
---
D HoverGallery.body.php
M HoverGallery.css
D HoverGallery.i18n.php
M HoverGallery.js
A HoverGallery.php
D Hovergallery.php
A extension.json
M i18n/en.json
M i18n/es.json
9 files changed, 114 insertions(+), 145 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/92/309092/1

diff --git a/HoverGallery.body.php b/HoverGallery.body.php
deleted file mode 100644
index c6db884..000
--- a/HoverGallery.body.php
+++ /dev/null
@@ -1,46 +0,0 @@
-addModules( 'ext.HoverGallery' );
-   return true;
-   }
-
-   public static function setParserHook( &$parser ) {
-   $parser->setHook( 'hovergallery', 'HoverGallery::render' );
-   return true;
-   }
-
-   public static function render( $input, array $ARGS, Parser $parser, 
PPFrame $frame ) {
-
-   $maxhoverwidth = '';
-   $maxhoverheight = '';
-   if ( array_key_exists( 'maxhoversize', $ARGS ) ) {
-   $maxhoverwidth = $ARGS['maxhoversize'];
-   $maxhoverheight = $ARGS['maxhoversize'];
-   }
-   if ( array_key_exists( 'maxhoverwidth', $ARGS ) ) {
-   $maxhoverwidth = $ARGS['maxhoverwidth'];
-   }
-   if ( array_key_exists( 'maxhoverheight', $ARGS ) ) {
-   $maxhoverheight = $ARGS['maxhoverheight'];
-   }   
-
-   $normalGallery = $parser->recursiveTagParse( '' . 
$input . '' );
-
-   $hiddenGallery = '';
-   $FILENAMES = explode( PHP_EOL, trim( $input ) );
-   $FILENAMES = array_filter( $FILENAMES );
-   foreach ( $FILENAMES as $filename ) {
-   if ( $maxhoverwidth or $maxhoverheight ) {
-   $hiddenGallery .= $parser->recursiveTagParse( 
'[[' . $filename . '|' . $maxhoverwidth . 'x' . $maxhoverheight . 'px]]' );
-   } else {
-   $hiddenGallery .= $parser->recursiveTagParse( 
'[[' . $filename . ']]' );
-   }
-   }
-   $hiddenGallery .= '';
-
-   return $normalGallery . $hiddenGallery;
-   }
-}
\ No newline at end of file
diff --git a/HoverGallery.css b/HoverGallery.css
index 34d2aa0..1a225ff 100644
--- a/HoverGallery.css
+++ b/HoverGallery.css
@@ -1,7 +1,8 @@
-div.hovergallery img {
+.hoverimage {
border-radius: 5px;
-   display: none;
pointer-events: none;
position: fixed;
-   z-index: 99;
+   top: 20px;
+   left: 20px;
+   z-index: 2147483647; /* Max possible value */
 }
\ No newline at end of file
diff --git a/HoverGallery.i18n.php b/HoverGallery.i18n.php
deleted file mode 100644
index 72270eb..000
--- a/HoverGallery.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShimfa51de7cbad51e14' ) ) {
-   function wfJsonI18nShimfa51de7cbad51e14( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-   if ( is_readable( $fileName ) ) {
-   $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-   foreach ( array_keys( $data ) as $key ) {
-   if ( $key === '' || $key[0] === '@' ) {
-   unset( $data[$key] );
-   }
-   }
-   $cachedData['messages'] = array_merge( $data, 
$cachedData[

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Rewrite extension so that images are not preloaded

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Rewrite extension so that images are not preloaded
..

Rewrite extension so that images are not preloaded

Before, all full-size images were preloaded and hidden so that when
a user hovered over a thumbnail, the corresponding full-size image
would be instantly shown. This had the huge problem of requiring to
preload all images even if no thumbnail was ever hovered. Now, images
are only loaded if a user hovers over the thumbnail.

Change-Id: I5225319d44f1db133f0c48de1ab0cb1117a75f72
---
M HoverGallery.css
M HoverGallery.js
M HoverGallery.php
M extension.json
4 files changed, 56 insertions(+), 59 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/98/309098/1

diff --git a/HoverGallery.css b/HoverGallery.css
index 34d2aa0..1a225ff 100644
--- a/HoverGallery.css
+++ b/HoverGallery.css
@@ -1,7 +1,8 @@
-div.hovergallery img {
+.hoverimage {
border-radius: 5px;
-   display: none;
pointer-events: none;
position: fixed;
-   z-index: 99;
+   top: 20px;
+   left: 20px;
+   z-index: 2147483647; /* Max possible value */
 }
\ No newline at end of file
diff --git a/HoverGallery.js b/HoverGallery.js
index 6d678ec..b405ee4 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -1,43 +1,37 @@
-jQuery( function ( $ ) {
+var HoverGallery = {
 
-   var thumbs, mouseX, mouseY, clientWidth, clientHeight, fullImage, 
fullImageWidth, fullImageHeight, fullImageX, fullImageY;
+   init: function () {
+   HoverGallery.bind();
+   },
 
-   // Get all the thumbnails
-   // The normal gallery is right before the hidden gallery, so just move 
to it and select all the images it contains
-   thumbs = $( 'div.hovergallery' ).prev().find( 'img' );
+   bind: function () {
+   $( '.gallery img' ).hover( HoverGallery.onMouseEnter, 
HoverGallery.onMouseLeave );
+   },
 
-   thumbs.mouseenter( function ( event ) {
+   onMouseEnter: function ( event ) {
+   var gallery = $( this ).closest( '.gallery' ),
+   fileUrls = gallery.data( 'hovergallery-fileurls' ),
+   maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
+   maxHoverHeight = gallery.data( 
'hovergallery-maxhoverheight' );
 
// Determine which of the thumbs is it
-   var thumbIndex = $.inArray( this, thumbs );
+   var thumbs = $( 'img', gallery ),
+   thumbIndex = $.inArray( this, thumbs );
 
-   // Get the corresponding full-size image, and its width and 
height
-   fullImage = $( 'div.hovergallery' ).children().eq( thumbIndex 
).children();
-
-   // Calculate the position of the mouse
-   mouseX = event.clientX;
-   mouseY = event.clientY;
-
-   // Now the position of the top left corner of the full image
-   fullImageX = mouseX + 10;
-   fullImageY = mouseY + 10;
-
-   // Make sure the image doesnt go off the screen
-   clientWidth = document.body.clientWidth;
-   clientHeight = document.body.clientHeight;
-   fullImageWidth = fullImage.width();
-   fullImageHeight = fullImage.height();
-   if ( mouseX + fullImageWidth > clientWidth ) {
-   fullImageX -= 20 + mouseX + fullImageWidth - 
clientWidth;
-   }
-   if ( mouseY + fullImageHeight > clientHeight ) {
-   fullImageY -= 20 + mouseY + fullImageHeight - 
clientHeight;
-   }
+   // Get the corresponding URL and build the image
+   var url = fileUrls[ thumbIndex ],
+   image = $( '' ).attr( 'src', url ).addClass( 
'hoverimage' ).css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   });
 
// Show the image
-   fullImage.css({ 'top': fullImageY, 'left': fullImageX }).show();
+   $( 'body' ).append( image );
+   },
 
-   }).mouseleave(function(){
-   fullImage.hide();
-   });
-}( jQuery ) );
\ No newline at end of file
+   onMouseLeave: function ( event ) {
+   $( 'body .hoverimage' ).remove();
+   }
+};
+
+$( HoverGallery.init );
\ No newline at end of file
diff --git a/HoverGallery.php b/HoverGallery.php
index 5b0be9f..2c9ee5a 100644
--- a/HoverGallery.php
+++ b/HoverGallery.php
@@ -2,20 +2,20 @@
 
 class HoverGallery {
 
-   public static function onBeforePageDisplay( &$output ) {
-   $output->addModules( 'ext.HoverGallery' );
+   static function onBeforePageDisplay( Output

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Remove unused variables

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Remove unused variables
..

Remove unused variables

Change-Id: I7e835b35c60712cbb43149924d9876d8116e8b82
---
M HoverGallery.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/99/309099/1

diff --git a/HoverGallery.js b/HoverGallery.js
index b405ee4..421ac93 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -8,7 +8,7 @@
$( '.gallery img' ).hover( HoverGallery.onMouseEnter, 
HoverGallery.onMouseLeave );
},
 
-   onMouseEnter: function ( event ) {
+   onMouseEnter: function () {
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -29,7 +29,7 @@
$( 'body' ).append( image );
},
 
-   onMouseLeave: function ( event ) {
+   onMouseLeave: function () {
$( 'body .hoverimage' ).remove();
}
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e835b35c60712cbb43149924d9876d8116e8b82
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Rewrite extension so that images are not preloaded

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Rewrite extension so that images are not preloaded
..


Rewrite extension so that images are not preloaded

Before, all full-size images were preloaded and hidden so that when
a user hovered over a thumbnail, the corresponding full-size image
would be instantly shown. This had the huge problem of requiring to
preload all images even if no thumbnail was ever hovered. Now, images
are only loaded if a user hovers over the thumbnail.

Change-Id: I5225319d44f1db133f0c48de1ab0cb1117a75f72
---
M HoverGallery.css
M HoverGallery.js
M HoverGallery.php
M extension.json
4 files changed, 56 insertions(+), 59 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/HoverGallery.css b/HoverGallery.css
index 34d2aa0..1a225ff 100644
--- a/HoverGallery.css
+++ b/HoverGallery.css
@@ -1,7 +1,8 @@
-div.hovergallery img {
+.hoverimage {
border-radius: 5px;
-   display: none;
pointer-events: none;
position: fixed;
-   z-index: 99;
+   top: 20px;
+   left: 20px;
+   z-index: 2147483647; /* Max possible value */
 }
\ No newline at end of file
diff --git a/HoverGallery.js b/HoverGallery.js
index 6d678ec..b405ee4 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -1,43 +1,37 @@
-jQuery( function ( $ ) {
+var HoverGallery = {
 
-   var thumbs, mouseX, mouseY, clientWidth, clientHeight, fullImage, 
fullImageWidth, fullImageHeight, fullImageX, fullImageY;
+   init: function () {
+   HoverGallery.bind();
+   },
 
-   // Get all the thumbnails
-   // The normal gallery is right before the hidden gallery, so just move 
to it and select all the images it contains
-   thumbs = $( 'div.hovergallery' ).prev().find( 'img' );
+   bind: function () {
+   $( '.gallery img' ).hover( HoverGallery.onMouseEnter, 
HoverGallery.onMouseLeave );
+   },
 
-   thumbs.mouseenter( function ( event ) {
+   onMouseEnter: function ( event ) {
+   var gallery = $( this ).closest( '.gallery' ),
+   fileUrls = gallery.data( 'hovergallery-fileurls' ),
+   maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
+   maxHoverHeight = gallery.data( 
'hovergallery-maxhoverheight' );
 
// Determine which of the thumbs is it
-   var thumbIndex = $.inArray( this, thumbs );
+   var thumbs = $( 'img', gallery ),
+   thumbIndex = $.inArray( this, thumbs );
 
-   // Get the corresponding full-size image, and its width and 
height
-   fullImage = $( 'div.hovergallery' ).children().eq( thumbIndex 
).children();
-
-   // Calculate the position of the mouse
-   mouseX = event.clientX;
-   mouseY = event.clientY;
-
-   // Now the position of the top left corner of the full image
-   fullImageX = mouseX + 10;
-   fullImageY = mouseY + 10;
-
-   // Make sure the image doesnt go off the screen
-   clientWidth = document.body.clientWidth;
-   clientHeight = document.body.clientHeight;
-   fullImageWidth = fullImage.width();
-   fullImageHeight = fullImage.height();
-   if ( mouseX + fullImageWidth > clientWidth ) {
-   fullImageX -= 20 + mouseX + fullImageWidth - 
clientWidth;
-   }
-   if ( mouseY + fullImageHeight > clientHeight ) {
-   fullImageY -= 20 + mouseY + fullImageHeight - 
clientHeight;
-   }
+   // Get the corresponding URL and build the image
+   var url = fileUrls[ thumbIndex ],
+   image = $( '' ).attr( 'src', url ).addClass( 
'hoverimage' ).css({
+   'max-width': maxHoverWidth + 'px',
+   'max-height': maxHoverHeight + 'px'
+   });
 
// Show the image
-   fullImage.css({ 'top': fullImageY, 'left': fullImageX }).show();
+   $( 'body' ).append( image );
+   },
 
-   }).mouseleave(function(){
-   fullImage.hide();
-   });
-}( jQuery ) );
\ No newline at end of file
+   onMouseLeave: function ( event ) {
+   $( 'body .hoverimage' ).remove();
+   }
+};
+
+$( HoverGallery.init );
\ No newline at end of file
diff --git a/HoverGallery.php b/HoverGallery.php
index 5b0be9f..2c9ee5a 100644
--- a/HoverGallery.php
+++ b/HoverGallery.php
@@ -2,20 +2,20 @@
 
 class HoverGallery {
 
-   public static function onBeforePageDisplay( &$output ) {
-   $output->addModules( 'ext.HoverGallery' );
+   static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
+   $out->addModules( 'ext.HoverGa

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Remove unused variables

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Remove unused variables
..


Remove unused variables

Change-Id: I7e835b35c60712cbb43149924d9876d8116e8b82
---
M HoverGallery.js
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/HoverGallery.js b/HoverGallery.js
index b405ee4..421ac93 100644
--- a/HoverGallery.js
+++ b/HoverGallery.js
@@ -8,7 +8,7 @@
$( '.gallery img' ).hover( HoverGallery.onMouseEnter, 
HoverGallery.onMouseLeave );
},
 
-   onMouseEnter: function ( event ) {
+   onMouseEnter: function () {
var gallery = $( this ).closest( '.gallery' ),
fileUrls = gallery.data( 'hovergallery-fileurls' ),
maxHoverWidth = gallery.data( 
'hovergallery-maxhoverwidth' ),
@@ -29,7 +29,7 @@
$( 'body' ).append( image );
},
 
-   onMouseLeave: function ( event ) {
+   onMouseLeave: function () {
$( 'body .hoverimage' ).remove();
}
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7e835b35c60712cbb43149924d9876d8116e8b82
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
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...Hovergallery[master]: Backwards compatibility

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Backwards compatibility
..

Backwards compatibility

Make the extension work from 1.24+

Change-Id: I870082e914a046fbe285671757b853f2442090b6
---
A HoverGallery.body.php
A HoverGallery.i18n.php
M HoverGallery.php
M extension.json
4 files changed, 104 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/66/309166/1

diff --git a/HoverGallery.body.php b/HoverGallery.body.php
new file mode 100644
index 000..724f30d
--- /dev/null
+++ b/HoverGallery.body.php
@@ -0,0 +1,48 @@
+addModules( 'ext.HoverGallery' );
+   return true;
+   }
+
+   static function onParserFirstCallInit( Parser &$parser ) {
+   $parser->setHook( 'hovergallery', 'HoverGallery::render' );
+   return true;
+   }
+
+   static function render( $input, array $ARGS, Parser $parser, PPFrame 
$frame ) {
+
+   $maxhoverwidth = 640;
+   $maxhoverheight = 640;
+   if ( array_key_exists( 'maxhoversize', $ARGS ) ) {
+   $maxhoverwidth = $ARGS['maxhoversize'];
+   $maxhoverheight = $ARGS['maxhoversize'];
+   }
+   if ( array_key_exists( 'maxhoverwidth', $ARGS ) ) {
+   $maxhoverwidth = $ARGS['maxhoverwidth'];
+   }
+   if ( array_key_exists( 'maxhoverheight', $ARGS ) ) {
+   $maxhoverheight = $ARGS['maxhoverheight'];
+   }
+
+   $FILEURLS = array();
+   $FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
+   foreach ( $FILENAMES as $filename ) {
+   $title = Title::newFromText( $filename, NS_FILE );
+   $file = wfLocalFile( $title );
+   $FILEURLS[] = $file->getFullUrl();
+   }
+
+   $fileUrls = json_encode( $FILEURLS );
+   $fileUrls = htmlspecialchars( $fileUrls, ENT_QUOTES );
+
+   $gallery = '' . $input . 
'';
+
+   return $parser->recursiveTagParse( $gallery );
+   }
+}
\ No newline at end of file
diff --git a/HoverGallery.i18n.php b/HoverGallery.i18n.php
new file mode 100644
index 000..39d2592
--- /dev/null
+++ b/HoverGallery.i18n.php
@@ -0,0 +1,35 @@
+https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
+ *
+ * Beginning with MediaWiki 1.23, translation strings are stored in json files,
+ * and the EXTENSION.i18n.php file only exists to provide compatibility with
+ * older releases of MediaWiki. For more information about this migration, see:
+ * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
+ *
+ * This shim maintains compatibility back to MediaWiki 1.17.
+ */
+$messages = array();
+if ( !function_exists( 'wfJsonI18nShim98208f6b515d7101' ) ) {
+   function wfJsonI18nShim98208f6b515d7101( $cache, $code, &$cachedData ) {
+   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
+   foreach ( $codeSequence as $csCode ) {
+   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
+   if ( is_readable( $fileName ) ) {
+   $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
+   foreach ( array_keys( $data ) as $key ) {
+   if ( $key === '' || $key[0] === '@' ) {
+   unset( $data[$key] );
+   }
+   }
+   $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
+   }
+
+   $cachedData['deps'][] = new FileDependency( $fileName );
+   }
+   return true;
+   }
+
+   $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShim98208f6b515d7101';
+}
diff --git a/HoverGallery.php b/HoverGallery.php
index 2c9ee5a..6ab4ae5 100644
--- a/HoverGallery.php
+++ b/HoverGallery.php
@@ -1,48 +1,25 @@
  __FILE__,
+   'name' => 'HoverGallery',
+   'descriptionmsg' => 'hovergallery-desc',
+   'version' => '1.0',
+   'author' => '[http://mediawiki.org/wiki/User:Felipe_Schenone Felipe 
Schenone]',
+   'url' => 'https://www.mediawiki.org/wiki/Extension:HoverGallery',
+);
 
-   static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
-   $out->addModules( 'ext.HoverGallery' );
-   return true;
-   }
+$wgResourceModules['ext.HoverGallery'] = array(
+   'scripts' => 'HoverGallery.js',
+   'styles' => 'HoverGallery.css',
+   'position' => 'top',
+   'localBasePath

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Backwards compatibility

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Backwards compatibility
..


Backwards compatibility

Make the extension work from 1.24+

Change-Id: I870082e914a046fbe285671757b853f2442090b6
---
A HoverGallery.body.php
A HoverGallery.i18n.php
M HoverGallery.php
M extension.json
4 files changed, 104 insertions(+), 44 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/HoverGallery.body.php b/HoverGallery.body.php
new file mode 100644
index 000..724f30d
--- /dev/null
+++ b/HoverGallery.body.php
@@ -0,0 +1,48 @@
+addModules( 'ext.HoverGallery' );
+   return true;
+   }
+
+   static function onParserFirstCallInit( Parser &$parser ) {
+   $parser->setHook( 'hovergallery', 'HoverGallery::render' );
+   return true;
+   }
+
+   static function render( $input, array $ARGS, Parser $parser, PPFrame 
$frame ) {
+
+   $maxhoverwidth = 640;
+   $maxhoverheight = 640;
+   if ( array_key_exists( 'maxhoversize', $ARGS ) ) {
+   $maxhoverwidth = $ARGS['maxhoversize'];
+   $maxhoverheight = $ARGS['maxhoversize'];
+   }
+   if ( array_key_exists( 'maxhoverwidth', $ARGS ) ) {
+   $maxhoverwidth = $ARGS['maxhoverwidth'];
+   }
+   if ( array_key_exists( 'maxhoverheight', $ARGS ) ) {
+   $maxhoverheight = $ARGS['maxhoverheight'];
+   }
+
+   $FILEURLS = array();
+   $FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
+   foreach ( $FILENAMES as $filename ) {
+   $title = Title::newFromText( $filename, NS_FILE );
+   $file = wfLocalFile( $title );
+   $FILEURLS[] = $file->getFullUrl();
+   }
+
+   $fileUrls = json_encode( $FILEURLS );
+   $fileUrls = htmlspecialchars( $fileUrls, ENT_QUOTES );
+
+   $gallery = '' . $input . 
'';
+
+   return $parser->recursiveTagParse( $gallery );
+   }
+}
\ No newline at end of file
diff --git a/HoverGallery.i18n.php b/HoverGallery.i18n.php
new file mode 100644
index 000..39d2592
--- /dev/null
+++ b/HoverGallery.i18n.php
@@ -0,0 +1,35 @@
+https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
+ *
+ * Beginning with MediaWiki 1.23, translation strings are stored in json files,
+ * and the EXTENSION.i18n.php file only exists to provide compatibility with
+ * older releases of MediaWiki. For more information about this migration, see:
+ * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
+ *
+ * This shim maintains compatibility back to MediaWiki 1.17.
+ */
+$messages = array();
+if ( !function_exists( 'wfJsonI18nShim98208f6b515d7101' ) ) {
+   function wfJsonI18nShim98208f6b515d7101( $cache, $code, &$cachedData ) {
+   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
+   foreach ( $codeSequence as $csCode ) {
+   $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
+   if ( is_readable( $fileName ) ) {
+   $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
+   foreach ( array_keys( $data ) as $key ) {
+   if ( $key === '' || $key[0] === '@' ) {
+   unset( $data[$key] );
+   }
+   }
+   $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
+   }
+
+   $cachedData['deps'][] = new FileDependency( $fileName );
+   }
+   return true;
+   }
+
+   $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShim98208f6b515d7101';
+}
diff --git a/HoverGallery.php b/HoverGallery.php
index 2c9ee5a..6ab4ae5 100644
--- a/HoverGallery.php
+++ b/HoverGallery.php
@@ -1,48 +1,25 @@
  __FILE__,
+   'name' => 'HoverGallery',
+   'descriptionmsg' => 'hovergallery-desc',
+   'version' => '1.0',
+   'author' => '[http://mediawiki.org/wiki/User:Felipe_Schenone Felipe 
Schenone]',
+   'url' => 'https://www.mediawiki.org/wiki/Extension:HoverGallery',
+);
 
-   static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
-   $out->addModules( 'ext.HoverGallery' );
-   return true;
-   }
+$wgResourceModules['ext.HoverGallery'] = array(
+   'scripts' => 'HoverGallery.js',
+   'styles' => 'HoverGallery.css',
+   'position' => 'top',
+   'localBasePath' => __DIR__,
+   'remoteExtPath' => 'Hovergallery',
+);
 
-   sta

[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Add support for image options

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add support for image options
..

Add support for image options

Change-Id: I54dbb64630e0d86171cb812cb7e5427f8f61ce6b
---
M HoverGallery.body.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Hovergallery 
refs/changes/73/309173/1

diff --git a/HoverGallery.body.php b/HoverGallery.body.php
index 724f30d..c8a5513 100644
--- a/HoverGallery.body.php
+++ b/HoverGallery.body.php
@@ -30,6 +30,7 @@
$FILEURLS = array();
$FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
foreach ( $FILENAMES as $filename ) {
+   $filename = strtok( $filename, '|' ); // Remove the 
options
$title = Title::newFromText( $filename, NS_FILE );
$file = wfLocalFile( $title );
$FILEURLS[] = $file->getFullUrl();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54dbb64630e0d86171cb812cb7e5427f8f61ce6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...Hovergallery[master]: Add support for image options

2016-09-07 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add support for image options
..


Add support for image options

Change-Id: I54dbb64630e0d86171cb812cb7e5427f8f61ce6b
---
M HoverGallery.body.php
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/HoverGallery.body.php b/HoverGallery.body.php
index 724f30d..c8a5513 100644
--- a/HoverGallery.body.php
+++ b/HoverGallery.body.php
@@ -30,6 +30,7 @@
$FILEURLS = array();
$FILENAMES = array_filter( explode( PHP_EOL, trim( $input ) ) );
foreach ( $FILENAMES as $filename ) {
+   $filename = strtok( $filename, '|' ); // Remove the 
options
$title = Title::newFromText( $filename, NS_FILE );
$file = wfLocalFile( $title );
$FILEURLS[] = $file->getFullUrl();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I54dbb64630e0d86171cb812cb7e5427f8f61ce6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Hovergallery
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
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...MsUpload[REL1_27]: Fix file summary message

2016-09-08 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix file summary message
..


Fix file summary message

The summary is wikitext, `mw.msg` parses limited wikitext into HTML, which not
only isn't the correct behaviour, but limits what wikitext can be used in the
summary; primarily templates.

Change-Id: I5dc384ddba4270c1f71005401e1bae073cd2b627
(cherry picked from commit ead03a7a42a3a369c37513f8220ed3c10a958d0f)
---
M MsUpload.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/MsUpload.js b/MsUpload.js
index e32fe73..46fd1cb 100755
--- a/MsUpload.js
+++ b/MsUpload.js
@@ -360,7 +360,7 @@
token: mw.user.tokens.get( 'editToken' ),
action: 'upload',
ignorewarnings: true,
-   comment: mw.msg( 'msu-comment' ),
+   comment: mw.message( 'msu-comment' ).plain(),
format: 'json'
}; // Set multipart_params
$( '#' + file.id + ' .file-progress-state' ).text( '0%' 
);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5dc384ddba4270c1f71005401e1bae073cd2b627
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MsUpload
Gerrit-Branch: REL1_27
Gerrit-Owner: Majr 
Gerrit-Reviewer: Nischayn22 
Gerrit-Reviewer: Ratin 
Gerrit-Reviewer: Sophivorus 
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...WikipediaExtracts[master]: Fix messages

2016-10-19 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix messages
..

Fix messages

The extension may be used to request pages from any Wikipedia, so
specifying a particular Wikipedia in the error message will sometimes
be wrong and confusing.

Change-Id: Ib11bd1b699094d93963555a509529d30392d5690
---
M i18n/de.json
M i18n/en.json
M i18n/es.json
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikipediaExtracts 
refs/changes/63/316863/1

diff --git a/i18n/de.json b/i18n/de.json
index 9fb392c..03f0299 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Ermöglicht das Einfügen von Inhaltsauszügen 
direkt aus der Wikipedia",
-   "wikipediaextracts-404": "Die Seite „$1“ wurde in der 
englischsprachigen Wikipedia nicht gefunden",
+   "wikipediaextracts-404": "Die Seite „$1“ wurde in der Wikipedia nicht 
gefunden",
"wikipediaextracts-invalid-language": "Der Sprachcode „$1“ ist 
ungültig",
"wikipediaextracts-credits": "Auszug aus [$1 Wikipedia]"
 }
diff --git a/i18n/en.json b/i18n/en.json
index ba72498..421214a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Enables to insert content extracted directly 
from Wikipedia.",
-   "wikipediaextracts-404": "The page '$1' was not found in the English 
Wikipedia",
+   "wikipediaextracts-404": "The page '$1' was not found in Wikipedia",
"wikipediaextracts-invalid-language": "The language code '$1' is 
invalid",
"wikipediaextracts-credits": "Extracted from [$1 
Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 5e4ac05..9aae230 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Permite insertar contenido extraido 
directamente de Wikipedia.",
-   "wikipediaextracts-404": "La página '$1' no fue encontrada en la 
Wikipedia en español",
+   "wikipediaextracts-404": "La página '$1' no fue encontrada en 
Wikipedia",
"wikipediaextracts-invalid-language": "El código de lenguaje '$1' es 
inválido",
"wikipediaextracts-credits": "Extraído de [$1 Wikipedia]"
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib11bd1b699094d93963555a509529d30392d5690
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikipediaExtracts
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikipediaExtracts[master]: Fix messages

2016-10-19 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix messages
..


Fix messages

The extension may be used to request pages from any Wikipedia, so
specifying a particular Wikipedia in the error message will sometimes
be wrong and confusing.

Change-Id: Ib11bd1b699094d93963555a509529d30392d5690
---
M i18n/de.json
M i18n/en.json
M i18n/es.json
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/de.json b/i18n/de.json
index 9fb392c..03f0299 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Ermöglicht das Einfügen von Inhaltsauszügen 
direkt aus der Wikipedia",
-   "wikipediaextracts-404": "Die Seite „$1“ wurde in der 
englischsprachigen Wikipedia nicht gefunden",
+   "wikipediaextracts-404": "Die Seite „$1“ wurde in der Wikipedia nicht 
gefunden",
"wikipediaextracts-invalid-language": "Der Sprachcode „$1“ ist 
ungültig",
"wikipediaextracts-credits": "Auszug aus [$1 Wikipedia]"
 }
diff --git a/i18n/en.json b/i18n/en.json
index ba72498..421214a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Enables to insert content extracted directly 
from Wikipedia.",
-   "wikipediaextracts-404": "The page '$1' was not found in the English 
Wikipedia",
+   "wikipediaextracts-404": "The page '$1' was not found in Wikipedia",
"wikipediaextracts-invalid-language": "The language code '$1' is 
invalid",
"wikipediaextracts-credits": "Extracted from [$1 
Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 5e4ac05..9aae230 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -5,7 +5,7 @@
]
},
"wikipediaextracts-desc": "Permite insertar contenido extraido 
directamente de Wikipedia.",
-   "wikipediaextracts-404": "La página '$1' no fue encontrada en la 
Wikipedia en español",
+   "wikipediaextracts-404": "La página '$1' no fue encontrada en 
Wikipedia",
"wikipediaextracts-invalid-language": "El código de lenguaje '$1' es 
inválido",
"wikipediaextracts-credits": "Extraído de [$1 Wikipedia]"
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib11bd1b699094d93963555a509529d30392d5690
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikipediaExtracts
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add italian localization

2016-10-20 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add italian localization
..


Add italian localization

Also minor tweak to the Spanish one.

Change-Id: I97f4e00290dc03319eb3426c344804ac338967ac
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index b3bedbb..8fb8309 100755
--- a/proveit.js
+++ b/proveit.js
@@ -69,6 +69,21 @@
'proveit-no-template': 'Aucun modèle',
'proveit-no-references': 'Aucune référence trouvée'
},
+   'it': {
+   'proveit-list-tab': 'Lista ($1)',
+   'proveit-add-tab': 'Aggiungere',
+   'proveit-reference-name-label': 'Nome di riferimento',
+   'proveit-reference-content-label': 'Contenuti di 
riferimento',
+   'proveit-reference-template-label': 'Template 
principale',
+   'proveit-cite-button': 'Citare',
+   'proveit-remove-button': 'Cancellare',
+   'proveit-insert-button': 'Inserire',
+   'proveit-update-button': 'Aggiornare',
+   'proveit-prompt-name': 'Il riferimento ha bisogno di un 
nome per essere citati:',
+   'proveit-confirm-remove': 'Questo elimina il 
riferimento e tutti gli citazione. Sei sicuro?',
+   'proveit-no-template': 'Senza template',
+   'proveit-no-references': 'Nessun riferimento trovato'
+   },
'ru': {
'proveit-list-tab': 'Список ($1)',
'proveit-add-tab': 'Добавить',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I97f4e00290dc03319eb3426c344804ac338967ac
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add italian localization

2016-10-20 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add italian localization
..

Add italian localization

Also minor tweak to the Spanish one.

Change-Id: I97f4e00290dc03319eb3426c344804ac338967ac
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/95/316995/1

diff --git a/proveit.js b/proveit.js
index b3bedbb..8fb8309 100755
--- a/proveit.js
+++ b/proveit.js
@@ -69,6 +69,21 @@
'proveit-no-template': 'Aucun modèle',
'proveit-no-references': 'Aucune référence trouvée'
},
+   'it': {
+   'proveit-list-tab': 'Lista ($1)',
+   'proveit-add-tab': 'Aggiungere',
+   'proveit-reference-name-label': 'Nome di riferimento',
+   'proveit-reference-content-label': 'Contenuti di 
riferimento',
+   'proveit-reference-template-label': 'Template 
principale',
+   'proveit-cite-button': 'Citare',
+   'proveit-remove-button': 'Cancellare',
+   'proveit-insert-button': 'Inserire',
+   'proveit-update-button': 'Aggiornare',
+   'proveit-prompt-name': 'Il riferimento ha bisogno di un 
nome per essere citati:',
+   'proveit-confirm-remove': 'Questo elimina il 
riferimento e tutti gli citazione. Sei sicuro?',
+   'proveit-no-template': 'Senza template',
+   'proveit-no-references': 'Nessun riferimento trovato'
+   },
'ru': {
'proveit-list-tab': 'Список ($1)',
'proveit-add-tab': 'Добавить',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97f4e00290dc03319eb3426c344804ac338967ac
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add German localization

2016-10-20 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add German localization
..

Add German localization

Change-Id: I5a3b210111617e6ce2657ec64707f127f2680d45
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/96/316996/1

diff --git a/proveit.js b/proveit.js
index 8fb8309..ad28d33 100755
--- a/proveit.js
+++ b/proveit.js
@@ -24,6 +24,21 @@
 * Interface messages
 */
messages: {
+   'de': {
+   'proveit-list-tab': 'Liste ($1)',
+   'proveit-add-tab': 'Hinzufügen',
+   'proveit-reference-name-label': 'Referenzname',
+   'proveit-reference-content-label': 'Referenzinhalt',
+   'proveit-reference-template-label': 'Hauptvorlage',
+   'proveit-cite-button': 'Zitieren',
+   'proveit-remove-button': 'Entfernen',
+   'proveit-insert-button': 'Einfügen',
+   'proveit-update-button': 'Aktualisieren',
+   'proveit-prompt-name': 'Die Referenz benötigt einen 
Namen, um zitiert zu werden:',
+   'proveit-confirm-remove': 'Dies wird die Referenz und 
alle ihre Zitate zu entfernen. Bist du sicher?',
+   'proveit-no-template': 'Keine Vorlage',
+   'proveit-no-references': 'Keine Referenzen gefunden'
+   },
'en': {
'proveit-list-tab': 'List ($1)',
'proveit-add-tab': 'Add',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a3b210111617e6ce2657ec64707f127f2680d45
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add German localization

2016-10-20 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add German localization
..


Add German localization

Change-Id: I5a3b210111617e6ce2657ec64707f127f2680d45
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 8fb8309..ad28d33 100755
--- a/proveit.js
+++ b/proveit.js
@@ -24,6 +24,21 @@
 * Interface messages
 */
messages: {
+   'de': {
+   'proveit-list-tab': 'Liste ($1)',
+   'proveit-add-tab': 'Hinzufügen',
+   'proveit-reference-name-label': 'Referenzname',
+   'proveit-reference-content-label': 'Referenzinhalt',
+   'proveit-reference-template-label': 'Hauptvorlage',
+   'proveit-cite-button': 'Zitieren',
+   'proveit-remove-button': 'Entfernen',
+   'proveit-insert-button': 'Einfügen',
+   'proveit-update-button': 'Aktualisieren',
+   'proveit-prompt-name': 'Die Referenz benötigt einen 
Namen, um zitiert zu werden:',
+   'proveit-confirm-remove': 'Dies wird die Referenz und 
alle ihre Zitate zu entfernen. Bist du sicher?',
+   'proveit-no-template': 'Keine Vorlage',
+   'proveit-no-references': 'Keine Referenzen gefunden'
+   },
'en': {
'proveit-list-tab': 'List ($1)',
'proveit-add-tab': 'Add',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5a3b210111617e6ce2657ec64707f127f2680d45
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Move l10n messages to JSON files in their own folder

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Move l10n messages to JSON files in their own folder
..

Move l10n messages to JSON files in their own folder

Load only the relevant messages via the Commons API

Change-Id: Id5a0ccf973e3bb83ced0418d3ebe6aee9cc86549
---
A i18n/de.json
A i18n/en.json
A i18n/es.json
A i18n/fr.json
A i18n/it.json
A i18n/qqq.json
A i18n/ru.json
M proveit.js
8 files changed, 180 insertions(+), 127 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/80/317180/1

diff --git a/i18n/de.json b/i18n/de.json
new file mode 100644
index 000..dea74ef
--- /dev/null
+++ b/i18n/de.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   'proveit-list-tab': 'Liste ($1)',
+   'proveit-add-tab': 'Hinzufügen',
+   'proveit-reference-name-label': 'Referenzname',
+   'proveit-reference-content-label': 'Referenzinhalt',
+   'proveit-reference-template-label': 'Hauptvorlage',
+   'proveit-cite-button': 'Zitieren',
+   'proveit-remove-button': 'Entfernen',
+   'proveit-insert-button': 'Einfügen',
+   'proveit-update-button': 'Aktualisieren',
+   'proveit-prompt-name': 'Die Referenz benötigt einen Namen, um zitiert 
zu werden:',
+   'proveit-confirm-remove': 'Dies wird die Referenz und alle ihre Zitate 
zu entfernen. Bist du sicher?',
+   'proveit-no-template': 'Keine Vorlage',
+   'proveit-no-references': 'Keine Referenzen gefunden'
+}
\ No newline at end of file
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 000..24b9ae5
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "List ($1)",
+   "proveit-add-tab": "Add",
+   "proveit-reference-name-label": "Reference name",
+   "proveit-reference-content-label": "Reference content",
+   "proveit-reference-template-label": "Main template",
+   "proveit-cite-button": "Cite",
+   "proveit-remove-button": "Remove",
+   "proveit-insert-button": "Insert",
+   "proveit-update-button": "Update",
+   "proveit-prompt-name": "The reference needs a name in order to be 
cited:",
+   "proveit-confirm-remove": "This will remove the reference and all of 
its citations. Are you sure?",
+   "proveit-no-template": "No template",
+   "proveit-no-references": "No references found"
+}
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
new file mode 100644
index 000..e72fd64
--- /dev/null
+++ b/i18n/es.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Agregar",
+   "proveit-reference-name-label": "Nombre de la referencia",
+   "proveit-reference-content-label": "Contenido de la referencia",
+   "proveit-reference-template-label": "Plantilla principal",
+   "proveit-cite-button": "Citar",
+   "proveit-remove-button": "Borrar",
+   "proveit-insert-button": "Insertar",
+   "proveit-update-button": "Actualizar",
+   "proveit-prompt-name": "La referencia necesita un nombre para ser 
citada:",
+   "proveit-confirm-remove": "Esto borrará la referencia y todas sus 
citas. ¿Estás seguro?",
+   "proveit-no-template": "Sin plantilla",
+   "proveit-no-references": "No se han encontrado referencias"
+}
\ No newline at end of file
diff --git a/i18n/fr.json b/i18n/fr.json
new file mode 100644
index 000..664c164
--- /dev/null
+++ b/i18n/fr.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   'proveit-list-tab': 'Lister ($1)',
+   'proveit-add-tab': 'Ajouter',
+   'proveit-reference-name-label': 'Nom de la référence',
+   'proveit-reference-content-label': 'Contenu de la référence',
+   'proveit-reference-template-label': 'Modèle de présentation',
+   'proveit-cite-button': 'Réutiliser',
+   'proveit-remove-button': 'Supprimer',
+   'proveit-insert-button': 'Insérer',
+   'proveit-update-button': 'Mettre à jour',
+   'proveit-prompt-name': "La référence a besoin d'un nom pour être 
réutilisée:",
+   'proveit-confirm-remove': "Cela supprimera la référence dans tout 
l'article. Êtes-vous sûr?",
+   'proveit-no-template': 'Aucun modèle',
+   'proveit-no-references': 'Aucune référence trouvée'
+}
\ No newline at end of file
diff --git a/i18n/it.json b/i18n/it.json
new file mode 100644
index 000..b854e0f
--- /dev/null
+++ b/i18n/it.json
@@ -0,0 +1,20 @@
+{
+   "@metadata":

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Move l10n messages to JSON files in their own folder

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Move l10n messages to JSON files in their own folder
..


Move l10n messages to JSON files in their own folder

Load only the relevant messages via the Commons API

Change-Id: Id5a0ccf973e3bb83ced0418d3ebe6aee9cc86549
---
A i18n/de.json
A i18n/en.json
A i18n/es.json
A i18n/fr.json
A i18n/it.json
A i18n/qqq.json
A i18n/ru.json
M proveit.js
8 files changed, 180 insertions(+), 127 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/de.json b/i18n/de.json
new file mode 100644
index 000..0779bd8
--- /dev/null
+++ b/i18n/de.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "Liste ($1)",
+   "proveit-add-tab": "Hinzufügen",
+   "proveit-reference-name-label": "Referenzname",
+   "proveit-reference-content-label": "Referenzinhalt",
+   "proveit-reference-template-label": "Hauptvorlage",
+   "proveit-cite-button": "Zitieren",
+   "proveit-remove-button": "Entfernen",
+   "proveit-insert-button": "Einfügen",
+   "proveit-update-button": "Aktualisieren",
+   "proveit-prompt-name": "Die Referenz benötigt einen Namen, um zitiert 
zu werden:",
+   "proveit-confirm-remove": "Dies wird die Referenz und alle ihre Zitate 
zu entfernen. Bist du sicher?",
+   "proveit-no-template": "Keine Vorlage",
+   "proveit-no-references": "Keine Referenzen gefunden"
+}
\ No newline at end of file
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 000..24b9ae5
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "List ($1)",
+   "proveit-add-tab": "Add",
+   "proveit-reference-name-label": "Reference name",
+   "proveit-reference-content-label": "Reference content",
+   "proveit-reference-template-label": "Main template",
+   "proveit-cite-button": "Cite",
+   "proveit-remove-button": "Remove",
+   "proveit-insert-button": "Insert",
+   "proveit-update-button": "Update",
+   "proveit-prompt-name": "The reference needs a name in order to be 
cited:",
+   "proveit-confirm-remove": "This will remove the reference and all of 
its citations. Are you sure?",
+   "proveit-no-template": "No template",
+   "proveit-no-references": "No references found"
+}
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
new file mode 100644
index 000..e72fd64
--- /dev/null
+++ b/i18n/es.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Agregar",
+   "proveit-reference-name-label": "Nombre de la referencia",
+   "proveit-reference-content-label": "Contenido de la referencia",
+   "proveit-reference-template-label": "Plantilla principal",
+   "proveit-cite-button": "Citar",
+   "proveit-remove-button": "Borrar",
+   "proveit-insert-button": "Insertar",
+   "proveit-update-button": "Actualizar",
+   "proveit-prompt-name": "La referencia necesita un nombre para ser 
citada:",
+   "proveit-confirm-remove": "Esto borrará la referencia y todas sus 
citas. ¿Estás seguro?",
+   "proveit-no-template": "Sin plantilla",
+   "proveit-no-references": "No se han encontrado referencias"
+}
\ No newline at end of file
diff --git a/i18n/fr.json b/i18n/fr.json
new file mode 100644
index 000..fdf5207
--- /dev/null
+++ b/i18n/fr.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Bastenbas"
+   ]
+   },
+   "proveit-list-tab": "Lister ($1)",
+   "proveit-add-tab": "Ajouter",
+   "proveit-reference-name-label": "Nom de la référence",
+   "proveit-reference-content-label": "Contenu de la référence",
+   "proveit-reference-template-label": "Modèle de présentation",
+   "proveit-cite-button": "Réutiliser",
+   "proveit-remove-button": "Supprimer",
+   "proveit-insert-button": "Insérer",
+   "proveit-update-button": "Mettre à jour",
+   "proveit-prompt-name": "La référence a besoin d'un nom pour être 
réutilisée:",
+   "proveit-confirm-remove": "Cela supprimera la référence dans tout 
l'article. Êtes-vous sûr?",
+   "proveit-no-template": "Aucun modèle",
+   "proveit-no-references": "Aucune référence trouvée"
+}
\ No newline at end of file
diff --git a/i18n/it.json b/i18n/it.json
new file mode 100644
index 000..dd9f42f
--- /dev/null
+++ b/i18n/it.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix so that ProveIt works on non-Wikimedia sites

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix so that ProveIt works on non-Wikimedia sites
..

Fix so that ProveIt works on non-Wikimedia sites

Change-Id: I135d8bf4c67cc7b26675c66306c4f44e4c41cb1c
---
M proveit.js
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/86/317186/1

diff --git a/proveit.js b/proveit.js
index 51a2013..1eff1f5 100755
--- a/proveit.js
+++ b/proveit.js
@@ -76,12 +76,13 @@
 
// Load the appropriate interface messages from Commons
var userLanguage = mw.config.get( 'wgUserLanguage' );
-   new mw.ForeignApi( '//commons.wikimedia.org/w/api.php' ).get({
+   $.get( '//commons.wikimedia.org/w/api.php', {
'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Fallback to English
'action': 'query',
'prop': 'revisions',
'rvprop': 'content',
-   'format': 'json'
+   'format': 'json',
+   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on non-Wikimedia sites
}).done( function ( data ) {
//console.log( data );
var page, enMessages, userLanguageMessages;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I135d8bf4c67cc7b26675c66306c4f44e4c41cb1c
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix so that ProveIt works on non-Wikimedia sites

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix so that ProveIt works on non-Wikimedia sites
..


Fix so that ProveIt works on non-Wikimedia sites

Change-Id: I135d8bf4c67cc7b26675c66306c4f44e4c41cb1c
---
M proveit.js
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 51a2013..1eff1f5 100755
--- a/proveit.js
+++ b/proveit.js
@@ -76,12 +76,13 @@
 
// Load the appropriate interface messages from Commons
var userLanguage = mw.config.get( 'wgUserLanguage' );
-   new mw.ForeignApi( '//commons.wikimedia.org/w/api.php' ).get({
+   $.get( '//commons.wikimedia.org/w/api.php', {
'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Fallback to English
'action': 'query',
'prop': 'revisions',
'rvprop': 'content',
-   'format': 'json'
+   'format': 'json',
+   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on non-Wikimedia sites
}).done( function ( data ) {
//console.log( data );
var page, enMessages, userLanguageMessages;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I135d8bf4c67cc7b26675c66306c4f44e4c41cb1c
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix false pipe matches inside wikilinks

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix false pipe matches inside wikilinks
..

Fix false pipe matches inside wikilinks

https://phabricator.wikimedia.org/T148234

Change-Id: I73bb02cc9258efdf553a52d290f7c5f759f20314
---
M proveit.js
1 file changed, 16 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/98/317298/1

diff --git a/proveit.js b/proveit.js
index 1eff1f5..4a99427 100755
--- a/proveit.js
+++ b/proveit.js
@@ -28,7 +28,7 @@
templates: {},
 
/**
-* Content language (may be different from the user language)
+* Content language of the wiki
 *
 * @type {string} defaults to English
 */
@@ -74,10 +74,10 @@
// Set the content language
proveit.contentLanguage = mw.config.get( 'wgContentLanguage' );
 
-   // Load the appropriate interface messages from Commons
+   // Get the interface messages from Commons
var userLanguage = mw.config.get( 'wgUserLanguage' );
$.get( '//commons.wikimedia.org/w/api.php', {
-   'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Fallback to English
+   'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Get the English messages as 
fallback
'action': 'query',
'prop': 'revisions',
'rvprop': 'content',
@@ -99,10 +99,10 @@
} else {
mw.messages.set( enMessages ); // Fallback to 
English
}
-   
+
// Build the interface
proveit.build();
-   
+
// Get the template data from the wiki
var templates = proveit.getOption( 'templates' );
new mw.Api().get({
@@ -346,9 +346,16 @@
 
paramsArray.shift(); // The first element is always 
empty
 
-   for ( paramString in paramsArray ) {
-
-   paramNameAndValue = paramsArray[ paramString 
].split( '=' );
+   for ( var i = 0; i < paramsArray.length; i++ ) {
+   paramString = $.trim( paramsArray[ i ] );
+   // If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
+   // For example |param=[[Joe|Doe]] or 
|param={{Some|template}}
+   // So we append the current paramString to the 
PREVIOUS paramValue
+   if ( paramString.indexOf( '=' ) === -1 ) {
+   reference.params[ paramName ] += '|' + 
paramString;
+   continue;
+   }
+   paramNameAndValue = paramString.split( '=' );
paramName = $.trim( paramNameAndValue[0] );
paramValue = $.trim( paramNameAndValue[1] );
 
@@ -396,7 +403,7 @@
if ( !proveitSummary ) {
return; // No summary defined
}
-   if ( currentSummary.indexOf( 'ProveIt' ) > -1 ) {
+   if ( currentSummary.indexOf( proveitSummary ) > -1 ) {
return; // Don't add it twice
}
$( '#wpSummary' ).val( currentSummary ? currentSummary + 
proveitSummary : proveitSummary );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73bb02cc9258efdf553a52d290f7c5f759f20314
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix false pipe matches inside wikilinks

2016-10-21 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix false pipe matches inside wikilinks
..


Fix false pipe matches inside wikilinks

https://phabricator.wikimedia.org/T148234

Change-Id: I73bb02cc9258efdf553a52d290f7c5f759f20314
---
M proveit.js
1 file changed, 16 insertions(+), 9 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 1eff1f5..4a99427 100755
--- a/proveit.js
+++ b/proveit.js
@@ -28,7 +28,7 @@
templates: {},
 
/**
-* Content language (may be different from the user language)
+* Content language of the wiki
 *
 * @type {string} defaults to English
 */
@@ -74,10 +74,10 @@
// Set the content language
proveit.contentLanguage = mw.config.get( 'wgContentLanguage' );
 
-   // Load the appropriate interface messages from Commons
+   // Get the interface messages from Commons
var userLanguage = mw.config.get( 'wgUserLanguage' );
$.get( '//commons.wikimedia.org/w/api.php', {
-   'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Fallback to English
+   'titles': 'MediaWiki:Gadget-ProveIt-' + userLanguage + 
'.json|MediaWiki:Gadget-ProveIt-en.json', // Get the English messages as 
fallback
'action': 'query',
'prop': 'revisions',
'rvprop': 'content',
@@ -99,10 +99,10 @@
} else {
mw.messages.set( enMessages ); // Fallback to 
English
}
-   
+
// Build the interface
proveit.build();
-   
+
// Get the template data from the wiki
var templates = proveit.getOption( 'templates' );
new mw.Api().get({
@@ -346,9 +346,16 @@
 
paramsArray.shift(); // The first element is always 
empty
 
-   for ( paramString in paramsArray ) {
-
-   paramNameAndValue = paramsArray[ paramString 
].split( '=' );
+   for ( var i = 0; i < paramsArray.length; i++ ) {
+   paramString = $.trim( paramsArray[ i ] );
+   // If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
+   // For example |param=[[Joe|Doe]] or 
|param={{Some|template}}
+   // So we append the current paramString to the 
PREVIOUS paramValue
+   if ( paramString.indexOf( '=' ) === -1 ) {
+   reference.params[ paramName ] += '|' + 
paramString;
+   continue;
+   }
+   paramNameAndValue = paramString.split( '=' );
paramName = $.trim( paramNameAndValue[0] );
paramValue = $.trim( paramNameAndValue[1] );
 
@@ -396,7 +403,7 @@
if ( !proveitSummary ) {
return; // No summary defined
}
-   if ( currentSummary.indexOf( 'ProveIt' ) > -1 ) {
+   if ( currentSummary.indexOf( proveitSummary ) > -1 ) {
return; // Don't add it twice
}
$( '#wpSummary' ).val( currentSummary ? currentSummary + 
proveitSummary : proveitSummary );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I73bb02cc9258efdf553a52d290f7c5f759f20314
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add portuguese localization

2016-10-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add portuguese localization
..

Add portuguese localization

Change-Id: Ibfb87beb26ef4fc0bbda669f37bff601bfd4c3d8
---
M i18n/es.json
A i18n/pt.json
2 files changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/88/317388/1

diff --git a/i18n/es.json b/i18n/es.json
index e72fd64..8301c6d 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -14,7 +14,7 @@
"proveit-insert-button": "Insertar",
"proveit-update-button": "Actualizar",
"proveit-prompt-name": "La referencia necesita un nombre para ser 
citada:",
-   "proveit-confirm-remove": "Esto borrará la referencia y todas sus 
citas. ¿Estás seguro?",
+   "proveit-confirm-remove": "Esto borra la referencia y todas sus citas. 
¿Estás seguro?",
"proveit-no-template": "Sin plantilla",
"proveit-no-references": "No se han encontrado referencias"
 }
\ No newline at end of file
diff --git a/i18n/pt.json b/i18n/pt.json
new file mode 100644
index 000..2a2665f
--- /dev/null
+++ b/i18n/pt.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Adicionar",
+   "proveit-reference-name-label": "Nome de referência",
+   "proveit-reference-content-label": "Conteúdo de referência",
+   "proveit-reference-template-label": "Predefinição mestre",
+   "proveit-cite-button": "Citação",
+   "proveit-remove-button": "Excluir",
+   "proveit-insert-button": "Inserir",
+   "proveit-update-button": "Atualizar",
+   "proveit-prompt-name": "A referência precisa de um nome a ser citados:",
+   "proveit-confirm-remove": "Isso elimina a referência e todos os 
compromissos. Tem certeza?",
+   "proveit-no-template": "Sem predefinição",
+   "proveit-no-references": "Não há referências encontradas"
+}
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfb87beb26ef4fc0bbda669f37bff601bfd4c3d8
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add portuguese localization

2016-10-23 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add portuguese localization
..


Add portuguese localization

Bug: T148337

Change-Id: Ibfb87beb26ef4fc0bbda669f37bff601bfd4c3d8
---
M i18n/es.json
A i18n/pt.json
2 files changed, 21 insertions(+), 1 deletion(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/es.json b/i18n/es.json
index e72fd64..8301c6d 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -14,7 +14,7 @@
"proveit-insert-button": "Insertar",
"proveit-update-button": "Actualizar",
"proveit-prompt-name": "La referencia necesita un nombre para ser 
citada:",
-   "proveit-confirm-remove": "Esto borrará la referencia y todas sus 
citas. ¿Estás seguro?",
+   "proveit-confirm-remove": "Esto borra la referencia y todas sus citas. 
¿Estás seguro?",
"proveit-no-template": "Sin plantilla",
"proveit-no-references": "No se han encontrado referencias"
 }
\ No newline at end of file
diff --git a/i18n/pt.json b/i18n/pt.json
new file mode 100644
index 000..2a2665f
--- /dev/null
+++ b/i18n/pt.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Felipe Schenone"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Adicionar",
+   "proveit-reference-name-label": "Nome de referência",
+   "proveit-reference-content-label": "Conteúdo de referência",
+   "proveit-reference-template-label": "Predefinição mestre",
+   "proveit-cite-button": "Citação",
+   "proveit-remove-button": "Excluir",
+   "proveit-insert-button": "Inserir",
+   "proveit-update-button": "Atualizar",
+   "proveit-prompt-name": "A referência precisa de um nome a ser citados:",
+   "proveit-confirm-remove": "Isso elimina a referência e todos os 
compromissos. Tem certeza?",
+   "proveit-no-template": "Sem predefinição",
+   "proveit-no-references": "Não há referências encontradas"
+}
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibfb87beb26ef4fc0bbda669f37bff601bfd4c3d8
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Update portuguese localization

2016-10-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Update portuguese localization
..

Update portuguese localization

Change-Id: I6009980e337fec263beb92c52b1e56087ad87317
---
M i18n/pt.json
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/95/317395/1

diff --git a/i18n/pt.json b/i18n/pt.json
index 2a2665f..6c1f4be 100644
--- a/i18n/pt.json
+++ b/i18n/pt.json
@@ -1,20 +1,21 @@
 {
"@metadata": {
"authors": [
-   "Felipe Schenone"
+   "Felipe Schenone",
+   "He7d3r"
]
},
"proveit-list-tab": "Lista ($1)",
"proveit-add-tab": "Adicionar",
-   "proveit-reference-name-label": "Nome de referência",
+   "proveit-reference-name-label": "Nome da referência",
"proveit-reference-content-label": "Conteúdo de referência",
-   "proveit-reference-template-label": "Predefinição mestre",
-   "proveit-cite-button": "Citação",
+   "proveit-reference-template-label": "Predefinição principal",
+   "proveit-cite-button": "Citar",
"proveit-remove-button": "Excluir",
"proveit-insert-button": "Inserir",
"proveit-update-button": "Atualizar",
-   "proveit-prompt-name": "A referência precisa de um nome a ser citados:",
-   "proveit-confirm-remove": "Isso elimina a referência e todos os 
compromissos. Tem certeza?",
+   "proveit-prompt-name": "A referência precisa de um nome para ser 
citada:",
+   "proveit-confirm-remove": "Isso eliminará a referência e todas as 
citações da mesma. Tem certeza?",
"proveit-no-template": "Sem predefinição",
-   "proveit-no-references": "Não há referências encontradas"
+   "proveit-no-references": "Não foram encontradas referências"
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6009980e337fec263beb92c52b1e56087ad87317
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Update portuguese localization

2016-10-23 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Update portuguese localization
..


Update portuguese localization

Change-Id: I6009980e337fec263beb92c52b1e56087ad87317
---
M i18n/pt.json
1 file changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/pt.json b/i18n/pt.json
index 2a2665f..6c1f4be 100644
--- a/i18n/pt.json
+++ b/i18n/pt.json
@@ -1,20 +1,21 @@
 {
"@metadata": {
"authors": [
-   "Felipe Schenone"
+   "Felipe Schenone",
+   "He7d3r"
]
},
"proveit-list-tab": "Lista ($1)",
"proveit-add-tab": "Adicionar",
-   "proveit-reference-name-label": "Nome de referência",
+   "proveit-reference-name-label": "Nome da referência",
"proveit-reference-content-label": "Conteúdo de referência",
-   "proveit-reference-template-label": "Predefinição mestre",
-   "proveit-cite-button": "Citação",
+   "proveit-reference-template-label": "Predefinição principal",
+   "proveit-cite-button": "Citar",
"proveit-remove-button": "Excluir",
"proveit-insert-button": "Inserir",
"proveit-update-button": "Atualizar",
-   "proveit-prompt-name": "A referência precisa de um nome a ser citados:",
-   "proveit-confirm-remove": "Isso elimina a referência e todos os 
compromissos. Tem certeza?",
+   "proveit-prompt-name": "A referência precisa de um nome para ser 
citada:",
+   "proveit-confirm-remove": "Isso eliminará a referência e todas as 
citações da mesma. Tem certeza?",
"proveit-no-template": "Sem predefinição",
-   "proveit-no-references": "Não há referências encontradas"
+   "proveit-no-references": "Não foram encontradas referências"
 }
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6009980e337fec263beb92c52b1e56087ad87317
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Siebrand 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Show only the title of the reference in the reference list

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Show only the title of the reference in the reference list
..

Show only the title of the reference in the reference list

Bug: T148982
Change-Id: I4cc6e16dd94d6a4b4109f4aa3ef6e18203342ab5
---
M proveit.css
M proveit.js
2 files changed, 61 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/64/317564/1

diff --git a/proveit.css b/proveit.css
index bf17f43..00a30db 100755
--- a/proveit.css
+++ b/proveit.css
@@ -79,7 +79,7 @@
margin-right: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-param-value {
+#proveit-reference-list .proveit-reference-item .proveit-main-value {
display: inline-block;
margin-right: 10px;
 }
diff --git a/proveit.js b/proveit.js
index 4a99427..85a428d 100755
--- a/proveit.js
+++ b/proveit.js
@@ -23,9 +23,9 @@
/**
 * Template data retrieved from the wiki
 *
-* @type {object}
+* @type {object} mapping template name to templateData
 */
-   templates: {},
+   templateData: {},
 
/**
 * Content language of the wiki
@@ -113,7 +113,7 @@
//console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
-   proveit.templates[ page.title ] = 
page.params;
+   proveit.templateData[ page.title ] = 
page;
}
proveit.scanForReferences();
});
@@ -319,7 +319,7 @@
 
// Determine if the reference uses a template by getting all 
the registered template names and searching for a match
var registeredTemplatesArray = [];
-   for ( var registeredTemplate in proveit.templates ) {
+   for ( var registeredTemplate in proveit.templateData ) {
registeredTemplate = registeredTemplate.substring( 
registeredTemplate.indexOf( ':' ) + 1 ); // Remove the namespace
registeredTemplatesArray.push( registeredTemplate );
}
@@ -677,14 +677,61 @@
};
 
/**
+* Get the full template name, like "Template:Cite book"
+*
+* @return {string} full template name
+*/
+   this.getTemplateName = function () {
+   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
+   templateNamespace = formattedNamespaces[10];
+   templateName = templateNamespace + ':' + 
this.template;
+   return templateName;
+   };
+
+   /**
+* Get the template data for this reference
+*
+* @return {object}
+*/
+   this.getTemplateData = function () {
+   var templateName = this.getTemplateName();
+   templateData = proveit.templateData[ 
templateName ]
+   return templateData;
+   };
+
+   /**
 * Get the registered parameters for this reference
 *
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
-   templateNamespace = formattedNamespaces[10];
-   return proveit.templates[ templateNamespace + ':' + 
this.template ];
+   var templateData = this.getTemplateData(),
+   paramsData = templateData.params;
+   return paramsData;
+   };
+
+   /**
+* Get the value of the main parameter for this reference
+*
+* @return {string} value of the main parameter for this 
reference
+*/
+   this.getMainValue = function () {
+   // Return the value of the parameter marked as "main", 
if any
+   var templateData = this.getTemplateData();
+   if ( 'proveit' in templateData && 'main' in 
templateData.proveit ) {
+   var mainParam = templateData.proveit.main;
+   if ( mainParam in this.params ) {
+   return this.params[ mainParam ];
+   }
+   }
+   // Else return the first param that has

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Show only the title of the reference in the reference list

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Show only the title of the reference in the reference list
..


Show only the title of the reference in the reference list

Also add support for specifying in the Map object
which parameters should be displayed as textareas

Bug: T148982
Change-Id: I4cc6e16dd94d6a4b4109f4aa3ef6e18203342ab5
---
M proveit.css
M proveit.js
2 files changed, 82 insertions(+), 44 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index bf17f43..00a30db 100755
--- a/proveit.css
+++ b/proveit.css
@@ -79,7 +79,7 @@
margin-right: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-param-value {
+#proveit-reference-list .proveit-reference-item .proveit-main-value {
display: inline-block;
margin-right: 10px;
 }
diff --git a/proveit.js b/proveit.js
index 4a99427..91beb20 100755
--- a/proveit.js
+++ b/proveit.js
@@ -23,9 +23,9 @@
/**
 * Template data retrieved from the wiki
 *
-* @type {object}
+* @type {object} mapping template name to templateData
 */
-   templates: {},
+   templateData: {},
 
/**
 * Content language of the wiki
@@ -113,7 +113,7 @@
//console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
-   proveit.templates[ page.title ] = 
page.params;
+   proveit.templateData[ page.title ] = 
page;
}
proveit.scanForReferences();
});
@@ -319,7 +319,7 @@
 
// Determine if the reference uses a template by getting all 
the registered template names and searching for a match
var registeredTemplatesArray = [];
-   for ( var registeredTemplate in proveit.templates ) {
+   for ( var registeredTemplate in proveit.templateData ) {
registeredTemplate = registeredTemplate.substring( 
registeredTemplate.indexOf( ':' ) + 1 ); // Remove the namespace
registeredTemplatesArray.push( registeredTemplate );
}
@@ -677,14 +677,61 @@
};
 
/**
+* Get the full template name, like "Template:Cite book"
+*
+* @return {string} full template name
+*/
+   this.getTemplateName = function () {
+   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
+   templateNamespace = formattedNamespaces[10];
+   templateName = templateNamespace + ':' + 
this.template;
+   return templateName;
+   };
+
+   /**
+* Get the template data for this reference
+*
+* @return {object}
+*/
+   this.getTemplateData = function () {
+   var templateName = this.getTemplateName();
+   templateData = proveit.templateData[ 
templateName ]
+   return templateData;
+   };
+
+   /**
 * Get the registered parameters for this reference
 *
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
-   templateNamespace = formattedNamespaces[10];
-   return proveit.templates[ templateNamespace + ':' + 
this.template ];
+   var templateData = this.getTemplateData(),
+   paramsData = templateData.params;
+   return paramsData;
+   };
+
+   /**
+* Get the value of the main parameter for this reference
+*
+* @return {string} value of the main parameter for this 
reference
+*/
+   this.getMainValue = function () {
+   // Return the value of the parameter marked as "main", 
if any
+   var templateMap = this.getTemplateMap();
+   if ( 'main' in templateMap ) {
+   var mainParam = templateMap.main;
+   if ( mainParam in this.params ) {
+   return this.params[ mainParam ];
+   }
+   }
+   // Else return the first param that has a value,
+

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix for long titles

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix for long titles
..

Fix for long titles

Also update the README

Change-Id: If6301cee13feb7160902dc47d1627ea3c83e0bea
---
M README.md
M proveit.css
M proveit.js
3 files changed, 4 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/29/317729/1

diff --git a/README.md b/README.md
index acb1404..2b69537 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 # ProveIt
 
-ProveIt is a powerful GUI tool to find, edit, add and cite references in any 
MediaWiki wiki.
+ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing Wikipedia articles.
 
 Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
diff --git a/proveit.css b/proveit.css
index 00a30db..3689215 100755
--- a/proveit.css
+++ b/proveit.css
@@ -79,11 +79,6 @@
margin-right: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-main-value {
-   display: inline-block;
-   margin-right: 10px;
-}
-
 #proveit-reference-list .proveit-reference-item .proveit-citations {
float: right;
 }
diff --git a/proveit.js b/proveit.js
index 91beb20..7042f01 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1,5 +1,5 @@
 /**
- * ProveIt is a powerful GUI tool to find, edit, add and cite references in 
any MediaWiki wiki
+ * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing Wikipedia articles.
  * Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
  *
  * Copyright 2008-2011 Georgia Tech Research Corporation, Atlanta, GA 
30332-0415, ALL RIGHTS RESERVED
@@ -857,9 +857,8 @@
item.html( templateSpan );
 
// Then add the main value of the reference 
(usually the title)
-   var mainValue = this.getMainValue(),
-   mainValueSpan = $( '' ).addClass( 
'proveit-main-value' ).text( mainValue );
-   item.append( mainValueSpan );
+   var mainValue = this.getMainValue();
+   item.append( mainValue );
 
} else {
item.text( this.content );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6301cee13feb7160902dc47d1627ea3c83e0bea
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix for long titles

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix for long titles
..


Fix for long titles

Also update the README

Bug: T149054

Change-Id: If6301cee13feb7160902dc47d1627ea3c83e0bea
---
M README.md
M proveit.css
M proveit.js
3 files changed, 4 insertions(+), 10 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index acb1404..2b69537 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 # ProveIt
 
-ProveIt is a powerful GUI tool to find, edit, add and cite references in any 
MediaWiki wiki.
+ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing Wikipedia articles.
 
 Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
diff --git a/proveit.css b/proveit.css
index 00a30db..3689215 100755
--- a/proveit.css
+++ b/proveit.css
@@ -79,11 +79,6 @@
margin-right: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-main-value {
-   display: inline-block;
-   margin-right: 10px;
-}
-
 #proveit-reference-list .proveit-reference-item .proveit-citations {
float: right;
 }
diff --git a/proveit.js b/proveit.js
index 91beb20..7042f01 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1,5 +1,5 @@
 /**
- * ProveIt is a powerful GUI tool to find, edit, add and cite references in 
any MediaWiki wiki
+ * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing Wikipedia articles.
  * Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
  *
  * Copyright 2008-2011 Georgia Tech Research Corporation, Atlanta, GA 
30332-0415, ALL RIGHTS RESERVED
@@ -857,9 +857,8 @@
item.html( templateSpan );
 
// Then add the main value of the reference 
(usually the title)
-   var mainValue = this.getMainValue(),
-   mainValueSpan = $( '' ).addClass( 
'proveit-main-value' ).text( mainValue );
-   item.append( mainValueSpan );
+   var mainValue = this.getMainValue();
+   item.append( mainValue );
 
} else {
item.text( this.content );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6301cee13feb7160902dc47d1627ea3c83e0bea
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: General debugging

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: General debugging
..

General debugging

Also some code pretification.

Change-Id: I886588d935cedaa82ed605cbd98d3685f3bbcf16
---
M proveit.js
1 file changed, 22 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/41/317741/1

diff --git a/proveit.js b/proveit.js
index 7042f01..85f83ab 100755
--- a/proveit.js
+++ b/proveit.js
@@ -681,11 +681,14 @@
 *
 * @return {string} full template name
 */
-   this.getTemplateName = function () {
-   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
-   templateNamespace = formattedNamespaces[10];
-   templateName = templateNamespace + ':' + 
this.template;
-   return templateName;
+   this.getTemplateTitle = function () {
+   var templateTitle = '';
+   if ( this.template ) {
+   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
+   templateNamespace = 
formattedNamespaces[10];
+   templateTitle = templateNamespace + ':' + 
this.template;
+   }
+   return templateTitle;
};
 
/**
@@ -694,8 +697,11 @@
 * @return {object}
 */
this.getTemplateData = function () {
-   var templateName = this.getTemplateName();
-   templateData = proveit.templateData[ 
templateName ]
+   var templateData = {},
+   templateTitle = this.getTemplateTitle();
+   if ( templateTitle in proveit.templateData ) {
+   templateData = proveit.templateData[ 
templateTitle ];
+   }
return templateData;
};
 
@@ -705,9 +711,12 @@
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var templateData = this.getTemplateData(),
-   paramsData = templateData.params;
-   return paramsData;
+   var registeredParams = {},
+   templateData = this.getTemplateData();
+   if ( 'params' in templateData ) {
+   registeredParams = templateData.params;
+   }
+   return registeredParams;
};
 
/**
@@ -802,7 +811,7 @@
this.getTemplateMap = function () {
var templateMap = {},
templateData = this.getTemplateData();
-   if ( 'maps' in templateData && 'proveit' in 
templateData.maps ) {
+   if ( templateData && 'maps' in templateData && 
'proveit' in templateData.maps ) {
templateMap = templateData.maps.proveit;
}
return templateMap;
@@ -921,8 +930,8 @@
templateOption = $( '' ).text( 
templateName ).val( '' );
templateSelect.append( templateOption );
templateRow.append( templateLabel, templateSelect );
-   for ( templateName in proveit.templateData ) {
-   templateName = templateName.substr( 
templateName.indexOf( ':' ) + 1 ); // Remove the namespace
+   for ( var templateTitle in proveit.templateData ) {
+   templateName = templateTitle.substr( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
templateOption = $( '' ).text( 
templateName ).val( templateName );
if ( this.template === templateName ) {
templateOption.attr( 'selected', 
'selected' );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I886588d935cedaa82ed605cbd98d3685f3bbcf16
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: General debugging

2016-10-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: General debugging
..


General debugging

Also some code pretification.

Change-Id: I886588d935cedaa82ed605cbd98d3685f3bbcf16
---
M proveit.js
1 file changed, 22 insertions(+), 13 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 7042f01..85f83ab 100755
--- a/proveit.js
+++ b/proveit.js
@@ -681,11 +681,14 @@
 *
 * @return {string} full template name
 */
-   this.getTemplateName = function () {
-   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
-   templateNamespace = formattedNamespaces[10];
-   templateName = templateNamespace + ':' + 
this.template;
-   return templateName;
+   this.getTemplateTitle = function () {
+   var templateTitle = '';
+   if ( this.template ) {
+   var formattedNamespaces = mw.config.get( 
'wgFormattedNamespaces' ),
+   templateNamespace = 
formattedNamespaces[10];
+   templateTitle = templateNamespace + ':' + 
this.template;
+   }
+   return templateTitle;
};
 
/**
@@ -694,8 +697,11 @@
 * @return {object}
 */
this.getTemplateData = function () {
-   var templateName = this.getTemplateName();
-   templateData = proveit.templateData[ 
templateName ]
+   var templateData = {},
+   templateTitle = this.getTemplateTitle();
+   if ( templateTitle in proveit.templateData ) {
+   templateData = proveit.templateData[ 
templateTitle ];
+   }
return templateData;
};
 
@@ -705,9 +711,12 @@
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var templateData = this.getTemplateData(),
-   paramsData = templateData.params;
-   return paramsData;
+   var registeredParams = {},
+   templateData = this.getTemplateData();
+   if ( 'params' in templateData ) {
+   registeredParams = templateData.params;
+   }
+   return registeredParams;
};
 
/**
@@ -802,7 +811,7 @@
this.getTemplateMap = function () {
var templateMap = {},
templateData = this.getTemplateData();
-   if ( 'maps' in templateData && 'proveit' in 
templateData.maps ) {
+   if ( templateData && 'maps' in templateData && 
'proveit' in templateData.maps ) {
templateMap = templateData.maps.proveit;
}
return templateMap;
@@ -921,8 +930,8 @@
templateOption = $( '' ).text( 
templateName ).val( '' );
templateSelect.append( templateOption );
templateRow.append( templateLabel, templateSelect );
-   for ( templateName in proveit.templateData ) {
-   templateName = templateName.substr( 
templateName.indexOf( ':' ) + 1 ); // Remove the namespace
+   for ( var templateTitle in proveit.templateData ) {
+   templateName = templateTitle.substr( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
templateOption = $( '' ).text( 
templateName ).val( templateName );
if ( this.template === templateName ) {
templateOption.attr( 'selected', 
'selected' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I886588d935cedaa82ed605cbd98d3685f3bbcf16
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Sort parameters by paramOrder

2016-10-25 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Sort parameters by paramOrder
..

Sort parameters by paramOrder

Also code simplifications and improvements

Bug: T149025
Change-Id: I833f388801e0b24399653c4ad8ee16f402dc1b27
---
M proveit.js
1 file changed, 50 insertions(+), 112 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/49/317849/1

diff --git a/proveit.js b/proveit.js
index 85f83ab..28ff6de 100755
--- a/proveit.js
+++ b/proveit.js
@@ -677,7 +677,7 @@
};
 
/**
-* Get the full template name, like "Template:Cite book"
+* Get the template title, like "Template:Cite book"
 *
 * @return {string} full template name
 */
@@ -694,15 +694,31 @@
/**
 * Get the template data for this reference
 *
-* @return {object}
+* @return {object} Template data
 */
this.getTemplateData = function () {
-   var templateData = {},
-   templateTitle = this.getTemplateTitle();
-   if ( templateTitle in proveit.templateData ) {
+   var templateData = {};
+   if ( this.template ) {
+   var templateTitle = this.getTemplateTitle();
templateData = proveit.templateData[ 
templateTitle ];
}
return templateData;
+   };
+
+   /**
+* Get the Map object for ProveIt from the template data
+*
+* @return {object} Map object
+*/
+   this.getTemplateMap = function () {
+   var templateMap = {};
+   if ( this.template ) {
+   var templateData = this.getTemplateData();
+   if ( 'maps' in templateData && 'proveit' in 
templateData.maps ) {
+   templateMap = templateData.maps.proveit;
+   }
+   }
+   return templateMap;
};
 
/**
@@ -711,10 +727,12 @@
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var registeredParams = {},
-   templateData = this.getTemplateData();
-   if ( 'params' in templateData ) {
-   registeredParams = templateData.params;
+   var registeredParams = {};
+   if ( this.template ) {
+   var templateData = this.getTemplateData();
+   templateData.paramOrder.forEach( function ( 
paramName ) {
+   registeredParams[ paramName ] = 
templateData.params[ paramName ];
+   });
}
return registeredParams;
};
@@ -725,96 +743,21 @@
 * @return {string} value of the main parameter for this 
reference
 */
this.getMainValue = function () {
-   // Return the value of the parameter marked as "main", 
if any
-   var templateMap = this.getTemplateMap();
-   if ( 'main' in templateMap ) {
-   var mainParam = templateMap.main;
-   if ( mainParam in this.params ) {
-   return this.params[ mainParam ];
+   var mainValue = this.content;
+   if ( this.template ) {
+   var templateMap = this.getTemplateMap();
+   if ( 'main' in templateMap && templateMap.main 
in this.params ) {
+   mainValue = this.params[ 
templateMap.main ];
+   } else {
+   var registeredParams = 
this.getRegisteredParams();
+   for ( var param in registeredParams ) {
+   if ( param in this.params ) {
+   mainValue = 
this.params[ param ];
+   }
+   }
}
}
-   // Else return the first param that has a value,
-   // starting with the required, 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Sort parameters by paramOrder

2016-10-25 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Sort parameters by paramOrder
..


Sort parameters by paramOrder

Also code simplifications and improvements

Bug: T149025
Change-Id: I833f388801e0b24399653c4ad8ee16f402dc1b27
---
M proveit.js
1 file changed, 50 insertions(+), 112 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 85f83ab..28ff6de 100755
--- a/proveit.js
+++ b/proveit.js
@@ -677,7 +677,7 @@
};
 
/**
-* Get the full template name, like "Template:Cite book"
+* Get the template title, like "Template:Cite book"
 *
 * @return {string} full template name
 */
@@ -694,15 +694,31 @@
/**
 * Get the template data for this reference
 *
-* @return {object}
+* @return {object} Template data
 */
this.getTemplateData = function () {
-   var templateData = {},
-   templateTitle = this.getTemplateTitle();
-   if ( templateTitle in proveit.templateData ) {
+   var templateData = {};
+   if ( this.template ) {
+   var templateTitle = this.getTemplateTitle();
templateData = proveit.templateData[ 
templateTitle ];
}
return templateData;
+   };
+
+   /**
+* Get the Map object for ProveIt from the template data
+*
+* @return {object} Map object
+*/
+   this.getTemplateMap = function () {
+   var templateMap = {};
+   if ( this.template ) {
+   var templateData = this.getTemplateData();
+   if ( 'maps' in templateData && 'proveit' in 
templateData.maps ) {
+   templateMap = templateData.maps.proveit;
+   }
+   }
+   return templateMap;
};
 
/**
@@ -711,10 +727,12 @@
 * @return {object} TemplateData of the registered parameters
 */
this.getRegisteredParams = function () {
-   var registeredParams = {},
-   templateData = this.getTemplateData();
-   if ( 'params' in templateData ) {
-   registeredParams = templateData.params;
+   var registeredParams = {};
+   if ( this.template ) {
+   var templateData = this.getTemplateData();
+   templateData.paramOrder.forEach( function ( 
paramName ) {
+   registeredParams[ paramName ] = 
templateData.params[ paramName ];
+   });
}
return registeredParams;
};
@@ -725,96 +743,21 @@
 * @return {string} value of the main parameter for this 
reference
 */
this.getMainValue = function () {
-   // Return the value of the parameter marked as "main", 
if any
-   var templateMap = this.getTemplateMap();
-   if ( 'main' in templateMap ) {
-   var mainParam = templateMap.main;
-   if ( mainParam in this.params ) {
-   return this.params[ mainParam ];
+   var mainValue = this.content;
+   if ( this.template ) {
+   var templateMap = this.getTemplateMap();
+   if ( 'main' in templateMap && templateMap.main 
in this.params ) {
+   mainValue = this.params[ 
templateMap.main ];
+   } else {
+   var registeredParams = 
this.getRegisteredParams();
+   for ( var param in registeredParams ) {
+   if ( param in this.params ) {
+   mainValue = 
this.params[ param ];
+   }
+   }
}
}
-   // Else return the first param that has a value,
-   // starting with the required, then suggested, last 
optional
-   var sortedP

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Don't match equal signs in param values

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Don't match equal signs in param values
..

Don't match equal signs in param values

Also rename method "scanForReferences" to "parse"

Bug: T149138
Change-Id: Iba2daf2bbd637afa4acbfe7a76d484a4a5bcdeb8
---
M proveit.js
1 file changed, 14 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/95/318095/1

diff --git a/proveit.js b/proveit.js
index 28ff6de..5e51af8 100755
--- a/proveit.js
+++ b/proveit.js
@@ -115,7 +115,7 @@
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
}
-   proveit.scanForReferences();
+   proveit.parse();
});
});
 
@@ -209,7 +209,7 @@
}
$( this ).addClass( 'active' ).siblings().removeClass( 
'active' );
 
-   proveit.scanForReferences();
+   proveit.parse();
});
 
addTab.click( function () {
@@ -232,11 +232,11 @@
},
 
/**
-* Scan for references in the textbox and display them
+* Parse the textbox for references and display them
 *
 * @return {void}
 */
-   scanForReferences: function () {
+   parse: function () {
 
// First define the list element
var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
@@ -342,25 +342,27 @@
 
// Extract the parameters and normalize them
var paramsArray = match[2].split( '|' ),
-   paramString, paramNameAndValue, paramName, 
paramValue;
+   paramString, indexOfEqual, paramName, 
paramValue;
 
paramsArray.shift(); // The first element is always 
empty
 
for ( var i = 0; i < paramsArray.length; i++ ) {
paramString = $.trim( paramsArray[ i ] );
+   indexOfEqual = paramString.indexOf( '=' );
+
// If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
-   // For example |param=[[Joe|Doe]] or 
|param={{Some|template}}
-   // So we append the current paramString to the 
PREVIOUS paramValue
-   if ( paramString.indexOf( '=' ) === -1 ) {
+   // for example |param=[[Joe|Doe]] or 
|param={{Some|template}}
+   // so we append the current paramString to the 
PREVIOUS paramValue
+   if ( indexOfEqual === -1 ) {
reference.params[ paramName ] += '|' + 
paramString;
continue;
}
-   paramNameAndValue = paramString.split( '=' );
-   paramName = $.trim( paramNameAndValue[0] );
-   paramValue = $.trim( paramNameAndValue[1] );
+
+   paramName = $.trim( paramString.substring( 0, 
indexOfEqual ) );
+   paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
if ( !paramName || !paramValue ) {
-   continue;
+   continue; // Malformed param, maybe 
"|foo=" or "|=bar"
}
 
reference.params[ paramName ] = paramValue;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba2daf2bbd637afa4acbfe7a76d484a4a5bcdeb8
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Don't match equal signs in param values

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Don't match equal signs in param values
..


Don't match equal signs in param values

Also rename method "scanForReferences" to "parse"

Bug: T149138
Change-Id: Iba2daf2bbd637afa4acbfe7a76d484a4a5bcdeb8
---
M proveit.js
1 file changed, 14 insertions(+), 12 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 28ff6de..5e51af8 100755
--- a/proveit.js
+++ b/proveit.js
@@ -115,7 +115,7 @@
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
}
-   proveit.scanForReferences();
+   proveit.parse();
});
});
 
@@ -209,7 +209,7 @@
}
$( this ).addClass( 'active' ).siblings().removeClass( 
'active' );
 
-   proveit.scanForReferences();
+   proveit.parse();
});
 
addTab.click( function () {
@@ -232,11 +232,11 @@
},
 
/**
-* Scan for references in the textbox and display them
+* Parse the textbox for references and display them
 *
 * @return {void}
 */
-   scanForReferences: function () {
+   parse: function () {
 
// First define the list element
var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
@@ -342,25 +342,27 @@
 
// Extract the parameters and normalize them
var paramsArray = match[2].split( '|' ),
-   paramString, paramNameAndValue, paramName, 
paramValue;
+   paramString, indexOfEqual, paramName, 
paramValue;
 
paramsArray.shift(); // The first element is always 
empty
 
for ( var i = 0; i < paramsArray.length; i++ ) {
paramString = $.trim( paramsArray[ i ] );
+   indexOfEqual = paramString.indexOf( '=' );
+
// If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
-   // For example |param=[[Joe|Doe]] or 
|param={{Some|template}}
-   // So we append the current paramString to the 
PREVIOUS paramValue
-   if ( paramString.indexOf( '=' ) === -1 ) {
+   // for example |param=[[Joe|Doe]] or 
|param={{Some|template}}
+   // so we append the current paramString to the 
PREVIOUS paramValue
+   if ( indexOfEqual === -1 ) {
reference.params[ paramName ] += '|' + 
paramString;
continue;
}
-   paramNameAndValue = paramString.split( '=' );
-   paramName = $.trim( paramNameAndValue[0] );
-   paramValue = $.trim( paramNameAndValue[1] );
+
+   paramName = $.trim( paramString.substring( 0, 
indexOfEqual ) );
+   paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
if ( !paramName || !paramValue ) {
-   continue;
+   continue; // Malformed param, maybe 
"|foo=" or "|=bar"
}
 
reference.params[ paramName ] = paramValue;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iba2daf2bbd637afa4acbfe7a76d484a4a5bcdeb8
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix parameter order bug

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix parameter order bug
..


Fix parameter order bug

Bug: T149176
Change-Id: Ice49aad3ee1b05e7a53d80f43d93f1a47a1bd39e
---
M proveit.js
1 file changed, 17 insertions(+), 19 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 5e51af8..5484e80 100755
--- a/proveit.js
+++ b/proveit.js
@@ -724,19 +724,17 @@
};
 
/**
-* Get the registered parameters for this reference
+* Get the parameter order from the template data
 *
-* @return {object} TemplateData of the registered parameters
+* @return {array}
 */
-   this.getRegisteredParams = function () {
-   var registeredParams = {};
+   this.getParamOrder = function () {
+   var paramOrder = [];
if ( this.template ) {
var templateData = this.getTemplateData();
-   templateData.paramOrder.forEach( function ( 
paramName ) {
-   registeredParams[ paramName ] = 
templateData.params[ paramName ];
-   });
+   paramOrder = templateData.paramOrder;
}
-   return registeredParams;
+   return paramOrder;
};
 
/**
@@ -751,10 +749,10 @@
if ( 'main' in templateMap && templateMap.main 
in this.params ) {
mainValue = this.params[ 
templateMap.main ];
} else {
-   var registeredParams = 
this.getRegisteredParams();
-   for ( var param in registeredParams ) {
-   if ( param in this.params ) {
-   mainValue = 
this.params[ param ];
+   var templateData = 
this.getTemplateData();
+   for ( var paramName in 
templateData.params ) {
+   if ( paramName in this.params ) 
{
+   mainValue = 
this.params[ paramName ];
}
}
}
@@ -884,12 +882,12 @@
// Add the parameter fields
var templateData = this.getTemplateData(),
templateMap = this.getTemplateMap(),
-   registeredParams = this.getRegisteredParams(),
-   paramData, paramLabel, paramPlaceholder, 
paramDescription, paramAlias, paramValue, row, label, paramNameInput, 
paramValueInput;
+   paramOrder = this.getParamOrder(),
+   paramName, paramData, paramLabel, 
paramPlaceholder, paramDescription, paramAlias, paramValue, row, label, 
paramNameInput, paramValueInput;
 
-   for ( var paramName in registeredParams ) {
-
-   paramData = registeredParams[ paramName ];
+   for ( var i = 0; i < paramOrder.length; i++ ) {
+   paramName = paramOrder[ i ];
+   paramData = templateData.params[ paramName ];
 
// Defaults
paramLabel = paramName;
@@ -920,8 +918,8 @@
if ( paramName in this.params ) {
paramValue = this.params[ paramName ];
} else {
-   for ( var i = 0; i < 
paramData.aliases.length; i++ ) {
-   paramAlias = paramData.aliases[ 
i ];
+   for ( var j = 0; j < 
paramData.aliases.length; j++ ) {
+   paramAlias = paramData.aliases[ 
j ];
paramAlias = $.trim( paramAlias 
);
if ( paramAlias in this.params 
) {
paramValue = 
this.params[ paramAlias ];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice49aad3ee1b05e7a53d80f43d93f1a47a1bd39e
Gerrit-PatchSet: 2
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix parameter order bug

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix parameter order bug
..

Fix parameter order bug

Bug: T149176
Change-Id: Ice49aad3ee1b05e7a53d80f43d93f1a47a1bd39e
---
M proveit.js
1 file changed, 17 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/05/318105/1

diff --git a/proveit.js b/proveit.js
index 5e51af8..5484e80 100755
--- a/proveit.js
+++ b/proveit.js
@@ -724,19 +724,17 @@
};
 
/**
-* Get the registered parameters for this reference
+* Get the parameter order from the template data
 *
-* @return {object} TemplateData of the registered parameters
+* @return {array}
 */
-   this.getRegisteredParams = function () {
-   var registeredParams = {};
+   this.getParamOrder = function () {
+   var paramOrder = [];
if ( this.template ) {
var templateData = this.getTemplateData();
-   templateData.paramOrder.forEach( function ( 
paramName ) {
-   registeredParams[ paramName ] = 
templateData.params[ paramName ];
-   });
+   paramOrder = templateData.paramOrder;
}
-   return registeredParams;
+   return paramOrder;
};
 
/**
@@ -751,10 +749,10 @@
if ( 'main' in templateMap && templateMap.main 
in this.params ) {
mainValue = this.params[ 
templateMap.main ];
} else {
-   var registeredParams = 
this.getRegisteredParams();
-   for ( var param in registeredParams ) {
-   if ( param in this.params ) {
-   mainValue = 
this.params[ param ];
+   var templateData = 
this.getTemplateData();
+   for ( var paramName in 
templateData.params ) {
+   if ( paramName in this.params ) 
{
+   mainValue = 
this.params[ paramName ];
}
}
}
@@ -884,12 +882,12 @@
// Add the parameter fields
var templateData = this.getTemplateData(),
templateMap = this.getTemplateMap(),
-   registeredParams = this.getRegisteredParams(),
-   paramData, paramLabel, paramPlaceholder, 
paramDescription, paramAlias, paramValue, row, label, paramNameInput, 
paramValueInput;
+   paramOrder = this.getParamOrder(),
+   paramName, paramData, paramLabel, 
paramPlaceholder, paramDescription, paramAlias, paramValue, row, label, 
paramNameInput, paramValueInput;
 
-   for ( var paramName in registeredParams ) {
-
-   paramData = registeredParams[ paramName ];
+   for ( var i = 0; i < paramOrder.length; i++ ) {
+   paramName = paramOrder[ i ];
+   paramData = templateData.params[ paramName ];
 
// Defaults
paramLabel = paramName;
@@ -920,8 +918,8 @@
if ( paramName in this.params ) {
paramValue = this.params[ paramName ];
} else {
-   for ( var i = 0; i < 
paramData.aliases.length; i++ ) {
-   paramAlias = paramData.aliases[ 
i ];
+   for ( var j = 0; j < 
paramData.aliases.length; j++ ) {
+   paramAlias = paramData.aliases[ 
j ];
paramAlias = $.trim( paramAlias 
);
if ( paramAlias in this.params 
) {
paramValue = 
this.params[ paramAlias ];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice49aad3ee1b05e7a53d80f43d93f1a47a1bd39e
Gerrit-PatchSet: 1
Gerrit-Project: wik

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for nested templates

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Support for nested templates
..

Support for nested templates

Bug: T148235
Change-Id: I8b8895247e1c29ab938c6ff333bf6b9080914d9e
---
M proveit.js
1 file changed, 46 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/26/318126/1

diff --git a/proveit.js b/proveit.js
index 5484e80..5c2fb5c 100755
--- a/proveit.js
+++ b/proveit.js
@@ -340,29 +340,57 @@
});
reference.template = template;
 
-   // Extract the parameters and normalize them
-   var paramsArray = match[2].split( '|' ),
-   paramString, indexOfEqual, paramName, 
paramValue;
+   /**
+* Now it's time to parse the parameters:
+* {{Cite book
+* |value1
+* |param1 = value2
+* |param2 = [[Some|link]]
+* |param3 = {{Subtemplate |foo |bar=baz}}
+* }}
+*/
 
-   paramsArray.shift(); // The first element is always 
empty
+   // We split by pipe, knowing that we may match pipes 
inside links and subtemplates
+   var paramArray = match[2].split( '|' ),
+   paramString, inLink = 0, inSubtemplate = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
 
-   for ( var i = 0; i < paramsArray.length; i++ ) {
-   paramString = $.trim( paramsArray[ i ] );
-   indexOfEqual = paramString.indexOf( '=' );
+   paramArray.shift(); // Get rid of the stuff before the 
first pipe
 
-   // If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
-   // for example |param=[[Joe|Doe]] or 
|param={{Some|template}}
-   // so we append the current paramString to the 
PREVIOUS paramValue
-   if ( indexOfEqual === -1 ) {
+   for ( var i = 0; i < paramArray.length; i++ ) {
+   paramString = $.trim( paramArray[ i ] );
+
+   // If we're in a link or subtemplate, we append 
the current paramString to the previous paramValue
+   if ( inLink || inSubtemplate ) {
reference.params[ paramName ] += '|' + 
paramString;
+   if ( paramString.indexOf( ']]' ) > -1 ) 
{
+   inLink--;
+   }
+   if ( paramString.indexOf( '}}' ) > -1 ) 
{
+   inSubtemplate--;
+   }
+   continue;
+   }
+
+   // If there's no = sign, it's an anonymous 
parameter
+   indexOfEqual = paramString.indexOf( '=' );
+   if ( indexOfEqual === -1 ) {
+   paramNumber++;
+   paramName = paramNumber;
+   paramValue = paramString;
continue;
}
 
paramName = $.trim( paramString.substring( 0, 
indexOfEqual ) );
paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
-   if ( !paramName || !paramValue ) {
-   continue; // Malformed param, maybe 
"|foo=" or "|=bar"
+   // If we find "[[" or "{{" in the paramValue, 
it means there's a link or subtemplate
+   // so we flag it to ignore all pipes and equal 
signs in future runs of the loop
+   // until all links and subtemplates are closed
+   if ( paramValue.indexOf( '[[' ) > -1 ) {
+   inLink++;
+   }
+   if ( paramValue.indexOf( '{{' ) > -1 ) {
+   inSubtemplate++;
}
 
reference.params[ paramName ] = paramValue;
@@ -749,10 +777,13 @@
if ( 'main' in templateMap && templateMap.main 
in this.params ) {
   

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for nested templates

2016-10-26 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Support for nested templates
..


Support for nested templates

Also minor fix to getParamOrder

Bug: T148884
Change-Id: I8b8895247e1c29ab938c6ff333bf6b9080914d9e
---
M proveit.js
1 file changed, 46 insertions(+), 15 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 5484e80..5c2fb5c 100755
--- a/proveit.js
+++ b/proveit.js
@@ -340,29 +340,57 @@
});
reference.template = template;
 
-   // Extract the parameters and normalize them
-   var paramsArray = match[2].split( '|' ),
-   paramString, indexOfEqual, paramName, 
paramValue;
+   /**
+* Now it's time to parse the parameters:
+* {{Cite book
+* |value1
+* |param1 = value2
+* |param2 = [[Some|link]]
+* |param3 = {{Subtemplate |foo |bar=baz}}
+* }}
+*/
 
-   paramsArray.shift(); // The first element is always 
empty
+   // We split by pipe, knowing that we may match pipes 
inside links and subtemplates
+   var paramArray = match[2].split( '|' ),
+   paramString, inLink = 0, inSubtemplate = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
 
-   for ( var i = 0; i < paramsArray.length; i++ ) {
-   paramString = $.trim( paramsArray[ i ] );
-   indexOfEqual = paramString.indexOf( '=' );
+   paramArray.shift(); // Get rid of the stuff before the 
first pipe
 
-   // If there's no = sign, it means we matched a 
pipe inside a link or template in the previous run of the loop
-   // for example |param=[[Joe|Doe]] or 
|param={{Some|template}}
-   // so we append the current paramString to the 
PREVIOUS paramValue
-   if ( indexOfEqual === -1 ) {
+   for ( var i = 0; i < paramArray.length; i++ ) {
+   paramString = $.trim( paramArray[ i ] );
+
+   // If we're in a link or subtemplate, we append 
the current paramString to the previous paramValue
+   if ( inLink || inSubtemplate ) {
reference.params[ paramName ] += '|' + 
paramString;
+   if ( paramString.indexOf( ']]' ) > -1 ) 
{
+   inLink--;
+   }
+   if ( paramString.indexOf( '}}' ) > -1 ) 
{
+   inSubtemplate--;
+   }
+   continue;
+   }
+
+   // If there's no = sign, it's an anonymous 
parameter
+   indexOfEqual = paramString.indexOf( '=' );
+   if ( indexOfEqual === -1 ) {
+   paramNumber++;
+   paramName = paramNumber;
+   paramValue = paramString;
continue;
}
 
paramName = $.trim( paramString.substring( 0, 
indexOfEqual ) );
paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
-   if ( !paramName || !paramValue ) {
-   continue; // Malformed param, maybe 
"|foo=" or "|=bar"
+   // If we find "[[" or "{{" in the paramValue, 
it means there's a link or subtemplate
+   // so we flag it to ignore all pipes and equal 
signs in future runs of the loop
+   // until all links and subtemplates are closed
+   if ( paramValue.indexOf( '[[' ) > -1 ) {
+   inLink++;
+   }
+   if ( paramValue.indexOf( '{{' ) > -1 ) {
+   inSubtemplate++;
}
 
reference.params[ paramName ] = paramValue;
@@ -749,10 +777,13 @@
if ( 'main' in templateMap && templateMap.main 
in this.params ) {
mainValue = this.params[

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Many improvements

2016-10-08 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Many improvements
..

Many improvements

- Improved comments
- Improved CSS class naming
- Code pretification
- Merged RawReference class with TemplateReference class
- Allow to switch between templates without losing data
- Allow to drag and resize widget
- Bugfixes
- All config options are now optional
- Add button to delete references and all their citations
- Add button to add a citation to a reference

Change-Id: Id7ce3cf5776e30f7336e25c92a19746d3a363568
---
M proveit.css
M proveit.js
2 files changed, 417 insertions(+), 336 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/28/314828/1

diff --git a/proveit.css b/proveit.css
index 54b47e6..dc4762e 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,11 +74,11 @@
cursor: pointer;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-template {
+#proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-required-value {
+#proveit-reference-list .proveit-reference-item .proveit-required-param-value {
margin-left: 10px;
 }
 
@@ -134,7 +134,7 @@
 }
 
 #proveit-reference-form textarea {
-   height: 100px;
+   height: 60px;
resize: vertical;
 }
 
@@ -158,6 +158,13 @@
border-radius: 3px;
cursor: pointer;
font: inherit;
+   margin-left: 10px;
padding: 5px;
pointer-events: all;
+}
+
+#proveit-buttons #proveit-cite-button,
+#proveit-buttons #proveit-remove-button,
+#proveit-buttons #proveit-params-button {
+   background: none;
 }
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index d8273f5..83e7a78 100755
--- a/proveit.js
+++ b/proveit.js
@@ -16,6 +16,11 @@
 var proveit = {
 
/**
+* URL of the ProveIt icon hosted at Commons
+*/
+   ICON: 
'//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png',
+
+   /**
 * Interface messages
 */
messages: {
@@ -23,20 +28,32 @@
'proveit-edit-tab': 'Edit',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
-   'proveit-reference-text-label': 'Reference text',
-   'proveit-template-label': 'Template',
+   'proveit-reference-content-label': 'Reference content',
+   'proveit-reference-template-label': 'Main template',
+   'proveit-params-button': 'Show all parameters',
+   'proveit-cite-button': 'Cite',
+   'proveit-remove-button': 'Remove',
'proveit-insert-button': 'Insert',
'proveit-update-button': 'Update',
+   'proveit-prompt-name': 'The reference needs a name in 
order to be cited:',
+   'proveit-confirm-remove': 'This will remove the 
reference and all of its citations. Are you sure?',
+   'proveit-no-template': 'No template',
'proveit-no-references': 'No references found'
},
'es': {
'proveit-edit-tab': 'Editar',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
-   'proveit-reference-text-label': 'Texto de la 
referencia',
-   'proveit-template-label': 'Plantilla',
+   'proveit-reference-content-label': 'Contenido de la 
referencia',
+   'proveit-reference-template-label': 'Plantilla 
principal',
+   'proveit-params-button': 'Ver todos los parámetros',
+   'proveit-cite-button': 'Citar',
+   'proveit-remove-button': 'Borrar',
'proveit-insert-button': 'Insertar',
'proveit-update-button': 'Actualizar',
+   'proveit-prompt-name': 'La referencia necesita un 
nombre para ser citada:',
+   'proveit-confirm-remove': 'Esto borrará la referencia y 
todas sus citas. ¿Estás seguro?',
+   'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
}
},
@@ -49,10 +66,9 @@
templates: {},
 
/**
-* Interface language
-* The default or fallback language is English
+* Interface language (may be different from the content language)
 *
-* @type {string}
+* @type {string} defaults to English
 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Many improvements

2016-10-08 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Many improvements
..


Many improvements

- Improved comments
- Improved CSS class naming
- Code pretification
- Merged RawReference class with TemplateReference class
- Allow to switch between templates without losing data
- Allow to drag and resize widget
- Bugfixes
- All config options are now optional
- Add button to delete references and all their citations
- Add button to add a citation to a reference

Change-Id: Id7ce3cf5776e30f7336e25c92a19746d3a363568
---
M proveit.css
M proveit.js
2 files changed, 417 insertions(+), 336 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index 54b47e6..dc4762e 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,11 +74,11 @@
cursor: pointer;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-template {
+#proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-required-value {
+#proveit-reference-list .proveit-reference-item .proveit-required-param-value {
margin-left: 10px;
 }
 
@@ -134,7 +134,7 @@
 }
 
 #proveit-reference-form textarea {
-   height: 100px;
+   height: 60px;
resize: vertical;
 }
 
@@ -158,6 +158,13 @@
border-radius: 3px;
cursor: pointer;
font: inherit;
+   margin-left: 10px;
padding: 5px;
pointer-events: all;
+}
+
+#proveit-buttons #proveit-cite-button,
+#proveit-buttons #proveit-remove-button,
+#proveit-buttons #proveit-params-button {
+   background: none;
 }
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index d8273f5..83e7a78 100755
--- a/proveit.js
+++ b/proveit.js
@@ -16,6 +16,11 @@
 var proveit = {
 
/**
+* URL of the ProveIt icon hosted at Commons
+*/
+   ICON: 
'//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png',
+
+   /**
 * Interface messages
 */
messages: {
@@ -23,20 +28,32 @@
'proveit-edit-tab': 'Edit',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
-   'proveit-reference-text-label': 'Reference text',
-   'proveit-template-label': 'Template',
+   'proveit-reference-content-label': 'Reference content',
+   'proveit-reference-template-label': 'Main template',
+   'proveit-params-button': 'Show all parameters',
+   'proveit-cite-button': 'Cite',
+   'proveit-remove-button': 'Remove',
'proveit-insert-button': 'Insert',
'proveit-update-button': 'Update',
+   'proveit-prompt-name': 'The reference needs a name in 
order to be cited:',
+   'proveit-confirm-remove': 'This will remove the 
reference and all of its citations. Are you sure?',
+   'proveit-no-template': 'No template',
'proveit-no-references': 'No references found'
},
'es': {
'proveit-edit-tab': 'Editar',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
-   'proveit-reference-text-label': 'Texto de la 
referencia',
-   'proveit-template-label': 'Plantilla',
+   'proveit-reference-content-label': 'Contenido de la 
referencia',
+   'proveit-reference-template-label': 'Plantilla 
principal',
+   'proveit-params-button': 'Ver todos los parámetros',
+   'proveit-cite-button': 'Citar',
+   'proveit-remove-button': 'Borrar',
'proveit-insert-button': 'Insertar',
'proveit-update-button': 'Actualizar',
+   'proveit-prompt-name': 'La referencia necesita un 
nombre para ser citada:',
+   'proveit-confirm-remove': 'Esto borrará la referencia y 
todas sus citas. ¿Estás seguro?',
+   'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
}
},
@@ -49,10 +66,9 @@
templates: {},
 
/**
-* Interface language
-* The default or fallback language is English
+* Interface language (may be different from the content language)
 *
-* @type {string}
+* @type {string} defaults to English
 */
userLanguage: 'en',
 
@@ -79,7 +95,7 @@
/**

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix parameters ignored after [[]]

2016-10-29 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Fix parameters ignored after [[]]
..

Fix parameters ignored after [[]]

Bug: T149479
Change-Id: Ib8864342b33a716826673a22c3b866f62c2f6b3f
---
M proveit.js
1 file changed, 16 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/98/318698/1

diff --git a/proveit.js b/proveit.js
index 5c2fb5c..c34e314 100755
--- a/proveit.js
+++ b/proveit.js
@@ -82,7 +82,7 @@
'prop': 'revisions',
'rvprop': 'content',
'format': 'json',
-   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on non-Wikimedia sites
+   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on localhost and non-Wikimedia sites
}).done( function ( data ) {
//console.log( data );
var page, enMessages, userLanguageMessages;
@@ -232,7 +232,7 @@
},
 
/**
-* Parse the textbox for references and display them
+* Parse the textbox for references and add them to the GUI
 *
 * @return {void}
 */
@@ -253,7 +253,7 @@
citations.push( citation );
}
 
-   // Third, look for all the raw and template references
+   // Third, look for all the references
var matches = wikitext.match( 
/<\s*ref[^\/]*>[\s\S]*?<\s*\/\s*ref\s*>/ig ); // We use [\s\S]* instead of .* 
to match newlines
 
if ( matches ) {
@@ -280,8 +280,10 @@
// Add the item to the list
referenceList.append( referenceItem );
}
+
$( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', i ) );
$( '#proveit-content' ).html( referenceList );
+
} else {
$( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', 0 ) );
$( '#proveit-content' ).html( $( '' ).attr( 'id', 
'proveit-no-references-message' ).text( proveit.getMessage( 'no-references' ) ) 
);
@@ -341,12 +343,13 @@
reference.template = template;
 
/**
-* Now it's time to parse the parameters:
+* Now it's time to parse the parameters, knowing they 
can contain pipes | and equal = signs:
 * {{Cite book
-* |value1
-* |param1 = value2
-* |param2 = [[Some|link]]
-* |param3 = {{Subtemplate |foo |bar=baz}}
+* |anonymous parameter
+* |param1 = value1
+* |param2 = http://example.com?query=string
+* |param3 = [[Some|link]]
+* |param4 = {{Subtemplate |anon |param=value}}
 * }}
 */
 
@@ -359,7 +362,7 @@
for ( var i = 0; i < paramArray.length; i++ ) {
paramString = $.trim( paramArray[ i ] );
 
-   // If we're in a link or subtemplate, we append 
the current paramString to the previous paramValue
+   // If we're inside a link or subtemplate, we 
append the current paramString to the previous paramValue and continue
if ( inLink || inSubtemplate ) {
reference.params[ paramName ] += '|' + 
paramString;
if ( paramString.indexOf( ']]' ) > -1 ) 
{
@@ -371,7 +374,7 @@
continue;
}
 
-   // If there's no = sign, it's an anonymous 
parameter
+   // If we reach this point and there's no equal 
sign, it's an anonymous parameter
indexOfEqual = paramString.indexOf( '=' );
if ( indexOfEqual === -1 ) {
paramNumber++;
@@ -384,12 +387,11 @@
paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
// If we find "[[" or "{{" in the paramValue, 
it means there's a link or subtemplate
-   // so we flag it to ignore all pipes and equal 
signs in future runs of the loop
-   // until all links and subtemplates are closed
-   if ( paramValue.indexOf( '[[' ) > -1 ) {
+   // s

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix parameters ignored after [[]]

2016-10-29 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Fix parameters ignored after [[]]
..


Fix parameters ignored after [[]]

Bug: T149479
Change-Id: Ib8864342b33a716826673a22c3b866f62c2f6b3f
---
M proveit.js
1 file changed, 16 insertions(+), 14 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 5c2fb5c..c34e314 100755
--- a/proveit.js
+++ b/proveit.js
@@ -82,7 +82,7 @@
'prop': 'revisions',
'rvprop': 'content',
'format': 'json',
-   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on non-Wikimedia sites
+   'origin': '*' // Allow requests from any origin so that 
ProveIt can be used on localhost and non-Wikimedia sites
}).done( function ( data ) {
//console.log( data );
var page, enMessages, userLanguageMessages;
@@ -232,7 +232,7 @@
},
 
/**
-* Parse the textbox for references and display them
+* Parse the textbox for references and add them to the GUI
 *
 * @return {void}
 */
@@ -253,7 +253,7 @@
citations.push( citation );
}
 
-   // Third, look for all the raw and template references
+   // Third, look for all the references
var matches = wikitext.match( 
/<\s*ref[^\/]*>[\s\S]*?<\s*\/\s*ref\s*>/ig ); // We use [\s\S]* instead of .* 
to match newlines
 
if ( matches ) {
@@ -280,8 +280,10 @@
// Add the item to the list
referenceList.append( referenceItem );
}
+
$( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', i ) );
$( '#proveit-content' ).html( referenceList );
+
} else {
$( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', 0 ) );
$( '#proveit-content' ).html( $( '' ).attr( 'id', 
'proveit-no-references-message' ).text( proveit.getMessage( 'no-references' ) ) 
);
@@ -341,12 +343,13 @@
reference.template = template;
 
/**
-* Now it's time to parse the parameters:
+* Now it's time to parse the parameters, knowing they 
can contain pipes | and equal = signs:
 * {{Cite book
-* |value1
-* |param1 = value2
-* |param2 = [[Some|link]]
-* |param3 = {{Subtemplate |foo |bar=baz}}
+* |anonymous parameter
+* |param1 = value1
+* |param2 = http://example.com?query=string
+* |param3 = [[Some|link]]
+* |param4 = {{Subtemplate |anon |param=value}}
 * }}
 */
 
@@ -359,7 +362,7 @@
for ( var i = 0; i < paramArray.length; i++ ) {
paramString = $.trim( paramArray[ i ] );
 
-   // If we're in a link or subtemplate, we append 
the current paramString to the previous paramValue
+   // If we're inside a link or subtemplate, we 
append the current paramString to the previous paramValue and continue
if ( inLink || inSubtemplate ) {
reference.params[ paramName ] += '|' + 
paramString;
if ( paramString.indexOf( ']]' ) > -1 ) 
{
@@ -371,7 +374,7 @@
continue;
}
 
-   // If there's no = sign, it's an anonymous 
parameter
+   // If we reach this point and there's no equal 
sign, it's an anonymous parameter
indexOfEqual = paramString.indexOf( '=' );
if ( indexOfEqual === -1 ) {
paramNumber++;
@@ -384,12 +387,11 @@
paramValue = $.trim( paramString.substring( 
indexOfEqual + 1 ) );
 
// If we find "[[" or "{{" in the paramValue, 
it means there's a link or subtemplate
-   // so we flag it to ignore all pipes and equal 
signs in future runs of the loop
-   // until all links and subtemplates are closed
-   if ( paramValue.indexOf( '[[' ) > -1 ) {
+   // so we flag it to ignore future pipes and 
equal signs until all lin

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Design changes

2016-10-30 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Design changes
..


Design changes

restructuring of the parameters' table, add td tag for the strokes and redesign 
buttons+smaller font

Bug: T149460
Change-Id: I547a27bedd8cd1ef6a82ef719a3fad8950ac16b7
---
M proveit.css
M proveit.js
2 files changed, 182 insertions(+), 179 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index 3689215..f84e365 100755
--- a/proveit.css
+++ b/proveit.css
@@ -1,167 +1,164 @@
-#proveit {
-   background: white;
-   border: 1px solid #ddd;
-   font-size: 14px;
-   position: fixed;
-   z-index: 2147483647; /* Max value */
-}
-
-#proveit-logo {
-   background: black;
-   color: white;
-   cursor: pointer;
-   float: right;
-   font-weight: bold;
-   padding: 15px;
-}
-
-#proveit-left-bracket {
-   color: yellow;
-   margin-right: 5px;
-}
-
-#proveit-right-bracket {
-   color: yellow;
-   margin-left: 5px;
-}
-
-#proveit-list-tab,
-#proveit-add-tab {
-   color: black;
-   cursor: pointer;
-   display: inline-block;
-   outline: none;
-   padding: 15px;
-}
-
-#proveit-list-tab.active,
-#proveit-add-tab.active {
-   background: #a7dcff;
-}
-
-#proveit-content {
-   background: #f4f4f4;
-   border-top: 1px solid #ddd;
-   overflow-y: scroll;
-   overflow-x: hidden;
-   width: 700px;
-   height: 300px;
-   resize: both;
-}
-
-#proveit-reference-list {
-   margin: 0;
-   padding: 0;
-}
-
-#proveit-reference-list .proveit-reference-item {
-   margin: 0;
-   overflow: hidden;
-   padding: 5px 10px;
-}
-
-#proveit-reference-list .proveit-reference-item:nth-child(even) {
-   background: #fff;
-}
-
-#proveit-reference-list .proveit-reference-item:hover {
-   background: #a7dcff;
-   cursor: pointer;
-}
-
-#proveit-reference-list .proveit-reference-item .proveit-reference-number {
-   font-weight: bold;
-   margin-right: 10px;
-}
-
-#proveit-reference-list .proveit-reference-item .proveit-reference-template {
-   font-weight: bold;
-   margin-right: 10px;
-}
-
-#proveit-reference-list .proveit-reference-item .proveit-citations {
-   float: right;
-}
-
-#proveit-reference-list .proveit-reference-item .proveit-citation {
-   color: blue;
-   padding: 3px;
-}
-
-#proveit-no-references-message {
-   text-align: center;
-   padding: 10px;
-}
-
-#proveit-reference-form {
-   margin-bottom: 50px;
-}
-
-#proveit-reference-form table {
-   border-spacing: 2px;
-   width: 100%;
-}
-
-#proveit-reference-form label {
-   border: 1px solid transparent;
-   box-sizing: border-box;
-   display: table-cell;
-   padding: 5px;
-   vertical-align: top;
-   width: 180px;
-}
-
-#proveit-reference-form .proveit-required label {
-   font-weight: bold;
-}
-
-#proveit-reference-form input,
-#proveit-reference-form select,
-#proveit-reference-form textarea {
-   -webkit-appearance: none;
-   background: white;
-   border: 1px solid #ddd;
-   border-radius: 0;
-   box-sizing: border-box;
-   display: table-cell;
-   font: inherit;
-   outline: none;
-   padding: 5px;
-   width: 100%;
-}
-
-#proveit-reference-form textarea {
-   height: 60px;
-   resize: vertical;
-}
-
-#proveit-buttons {
-   background: white;
-   border-spacing: 0;
-   border-top: 1px solid #ddd;
-   box-sizing: border-box;
-   margin: 0;
-   padding: 10px;
-   pointer-events: none;
-   position: absolute;
-   bottom: 0;
-   text-align: right;
-   width: 100%;
-}
-
-#proveit-buttons button {
-   background: #a7dcff;
-   border: 1px solid #ccc;
-   border-radius: 3px;
-   cursor: pointer;
-   font: inherit;
-   margin-left: 10px;
-   padding: 5px;
-   pointer-events: all;
-}
-
-#proveit-buttons #proveit-cite-button,
-#proveit-buttons #proveit-remove-button,
-#proveit-buttons #proveit-params-button {
-   background: none;
+#proveit {
+   background: white;
+   border: 1px solid #ddd;
+   font-size: 0.8em;
+   position: fixed;
+   z-index: 2147483647; /* Max value */
+}
+
+#proveit-logo {
+   background: black;
+   color: white;
+   cursor: pointer;
+   float: right;
+   font-weight: bold;
+   padding: 15px;
+}
+
+#proveit-left-bracket {
+   color: yellow;
+   margin-right: 5px;
+}
+
+#proveit-right-bracket {
+   color: yellow;
+   margin-left: 5px;
+}
+
+#proveit-list-tab,
+#proveit-add-tab {
+   color: black;
+   cursor: pointer;
+   display: inline-block;
+   outline: none;
+   padding: 15px;
+}
+
+#proveit-list-tab.active,
+#proveit-add-tab.active {
+   background: #ccc;
+}
+
+#proveit-header span:not(.active):not(#pro

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add button for OldToolbar

2016-10-31 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add button for OldToolbar
..


Add button for OldToolbar

Fix for destroing buttons in OldToolbar

Bug: T149562
Change-Id: Iebda85ddfa60906f3f491ca025b1146104586f14
---
M proveit.js
1 file changed, 37 insertions(+), 22 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 4c1456e..f19cae4 100755
--- a/proveit.js
+++ b/proveit.js
@@ -16,9 +16,11 @@
 var proveit = {
 
/**
-* URL of the ProveIt icon hosted at Commons
+* URL of the ProveIt icons hosted at Commons
 */
ICON: 
'//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png',
+
+   OLDICON: 
'//upload.wikimedia.org/wikipedia/commons/d/df/ProveitOldIcon.png',
 
/**
 * Template data retrieved from the wiki
@@ -119,29 +121,42 @@
});
});
 
-   // Replace the Reference button for the ProveIt button
-   proveit.getTextbox().wikiEditor( 'removeFromToolbar', {
-   'section': 'main',
-   'group': 'insert',
-   'tool': 'reference'
-   });
-   proveit.getTextbox().wikiEditor( 'addToToolbar', {
-   'section': 'main',
-   'group': 'insert',
-   'tools': {
-   'proveit': {
-   'label': 'ProveIt',
-   'type': 'button',
-   'icon': proveit.ICON,
-   'action': {
-   'type': 'callback',
-   'execute': function () {
-   $( '#proveit' 
).toggle();
+   // Replace the Reference button for the ProveIt button in the 
new toolbar
+   if ( mw.user.options.get( 'usebetatoolbar' ) === 1 ) {
+   proveit.getTextbox().wikiEditor( 'removeFromToolbar', {
+   'section': 'main',
+   'group': 'insert',
+   'tool': 'reference'
+   });
+   proveit.getTextbox().wikiEditor( 'addToToolbar', {
+   'section': 'main',
+   'group': 'insert',
+   'tools': {
+   'proveit': {
+   'label': 'ProveIt',
+   'type': 'button',
+   'icon': proveit.ICON,
+   'action': {
+   'type': 'callback',
+   'execute': function () {
+   $( '#proveit' 
).toggle();
+   }
}
}
}
-   }
-   });
+   });
+   // Add the ProveIt button in the old toolbar
+   } else if ( mw.user.options.get( 'showtoolbar' ) === 1 ) {
+   mw.loader.using( 'mediawiki.toolbar', function () {
+   $( '' )
+   .addClass( 'mw-toolbar-editbutton' )
+   .attr( 'title', 'ProveIt' )
+   .css( 'background-image', 'url(' + 
proveit.OLDICON + ')' )
+   .appendTo( '#toolbar' ).click( function () {
+   $( '#proveit' ).toggle();
+   });
+   });
+   }
},
 
/**
@@ -1058,4 +1073,4 @@
 
 $( proveit.init );
 
-}( mw, jQuery ) );
\ No newline at end of file
+}( mw, jQuery ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebda85ddfa60906f3f491ca025b1146104586f14
Gerrit-PatchSet: 4
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Iniquity 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for multiple templates

2016-10-31 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Support for multiple templates
..

Support for multiple templates

Bug: T148884
Change-Id: I5bde89e5422b392b420c04e659ea96a93cb6315b
---
M proveit.js
1 file changed, 47 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/75/318975/1

diff --git a/proveit.js b/proveit.js
index f19cae4..8e1b623 100755
--- a/proveit.js
+++ b/proveit.js
@@ -275,7 +275,7 @@
var i, j, reference, referenceItem;
for ( i = 0; i < matches.length; i++ ) {
// Turn all the matches into reference objects
-   reference = proveit.makeReference( matches[ i ] 
);
+   reference = proveit.parseReference( matches[ i 
] );
 
// For each reference, check the citations 
array for citations to it
for ( j = 0; j < citations.length; j++ ) {
@@ -311,8 +311,8 @@
 * @param {string} wikitext of the reference
 * @return {object} reference object
 */
-   makeReference: function ( referenceString ) {
-   // Extract the name, if any
+   parseReference: function ( referenceString ) {
+   // Extract the reference name, if any
// Three patterns: ,  and 
var referenceName = null,
match = referenceString.match( 
/<[\s]*ref[\s]*name[\s]*=[\s]*(?:(?:\"(.*?)\")|(?:\'(.*?)\')|(?:(.*?)))[\s]*>/i 
);
@@ -320,7 +320,7 @@
referenceName = match[1] || match[2] || match[3];
}
 
-   // Extract the index
+   // Get the index
var referenceIndex = proveit.getTextbox().val().indexOf( 
referenceString );
 
// Extract the content
@@ -334,31 +334,44 @@
'content': referenceContent
});
 
-   // Determine if the reference uses a template by getting all 
the registered template names and searching for a match
-   var registeredTemplatesArray = [];
-   for ( var registeredTemplate in proveit.templateData ) {
-   registeredTemplate = registeredTemplate.substring( 
registeredTemplate.indexOf( ':' ) + 1 ); // Remove the namespace
-   registeredTemplatesArray.push( registeredTemplate );
+   // Search for the main template of the reference
+   var templateName,
+   templateRegex,
+   indexStart;
+   for ( var templateTitle in proveit.templateData ) {
+   templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
+   templateRegex = new RegExp( '{{\\s*' + templateName, 
'i' );
+   indexStart = referenceContent.search( templateRegex );
+   if ( indexStart > -1 ) {
+   reference.template = templateName;
+   break;
+   }
}
-   var registeredTemplatesDisjunction = 
registeredTemplatesArray.join( '|' ),
-   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ); // We use [\s\S]* 
instead of .* to match newlines
-   match = referenceContent.match( regExp );
 
-   // If there's a match, add the template data to the reference
-   if ( match ) {
-   reference.templateString = match[0];
+   // The rest of the code is for when a main template was found
+   if ( reference.template ) {
 
-   // Extract and the template name and normalize it
-   var template = match[1];
-   registeredTemplatesArray.forEach( function ( 
registeredTemplate ) {
-   if ( template.toLowerCase() === 
registeredTemplate.toLowerCase() ) {
-   template = registeredTemplate;
+   // Figure out the indexEnd by searching for the closing 
"}}"
+   // knowing there may be subtemplates and other 
templates after the main template
+   var indexEnd = referenceContent.length,
+   templateLevel = 0;
+   for ( var i = indexStart; i < indexEnd; i++ ) {
+   if ( referenceContent[ i ] + referenceContent[ 
i + 1 ] === '{{' ) {
+   templateLevel++;
+   i++; // We speed up the loop to avoid 
multiple matches when two or more templates are found to

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Match specific subtemplate before general templates

2016-10-31 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Match specific subtemplate before general templates
..

Match specific subtemplate before general templates

Bug: T148235
Change-Id: I5a795160d4a482669766be6266fa12d19298bc4b
---
M proveit.js
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/82/318982/1

diff --git a/proveit.js b/proveit.js
index 8e1b623..fa41230 100755
--- a/proveit.js
+++ b/proveit.js
@@ -335,10 +335,13 @@
});
 
// Search for the main template of the reference
-   var templateName,
+   var templateTitles = Object.keys( proveit.templateData 
).sort().reverse(), // Reverse the order to match "Cite book:Sub" before "Cite 
book"
+   templateTitle,
+   templateName,
templateRegex,
indexStart;
-   for ( var templateTitle in proveit.templateData ) {
+   for ( var i = 0; i < templateTitles.length; i++ ) {
+   templateTitle = templateTitles[ i ];
templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
templateRegex = new RegExp( '{{\\s*' + templateName, 
'i' );
indexStart = referenceContent.search( templateRegex );
@@ -355,7 +358,7 @@
// knowing there may be subtemplates and other 
templates after the main template
var indexEnd = referenceContent.length,
templateLevel = 0;
-   for ( var i = indexStart; i < indexEnd; i++ ) {
+   for ( i = indexStart; i < indexEnd; i++ ) {
if ( referenceContent[ i ] + referenceContent[ 
i + 1 ] === '{{' ) {
templateLevel++;
i++; // We speed up the loop to avoid 
multiple matches when two or more templates are found together

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a795160d4a482669766be6266fa12d19298bc4b
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Match more specific templates first

2016-10-31 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Match more specific templates first
..


Match more specific templates first

For example, match "Cite books" before "Cite book"

Bug: T148235
Change-Id: I5a795160d4a482669766be6266fa12d19298bc4b
---
M proveit.js
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 8e1b623..16fa27f 100755
--- a/proveit.js
+++ b/proveit.js
@@ -335,12 +335,15 @@
});
 
// Search for the main template of the reference
-   var templateName,
+   var templateTitles = Object.keys( proveit.templateData 
).sort().reverse(), // Match "Cite books" before "Cite book"
+   templateTitle,
+   templateName,
templateRegex,
indexStart;
-   for ( var templateTitle in proveit.templateData ) {
+   for ( var i = 0; i < templateTitles.length; i++ ) {
+   templateTitle = templateTitles[ i ];
templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
-   templateRegex = new RegExp( '{{\\s*' + templateName, 
'i' );
+   templateRegex = new RegExp( '{{\\s*' + templateName + 
'[\\s|]', 'i' );
indexStart = referenceContent.search( templateRegex );
if ( indexStart > -1 ) {
reference.template = templateName;
@@ -355,7 +358,7 @@
// knowing there may be subtemplates and other 
templates after the main template
var indexEnd = referenceContent.length,
templateLevel = 0;
-   for ( var i = indexStart; i < indexEnd; i++ ) {
+   for ( i = indexStart; i < indexEnd; i++ ) {
if ( referenceContent[ i ] + referenceContent[ 
i + 1 ] === '{{' ) {
templateLevel++;
i++; // We speed up the loop to avoid 
multiple matches when two or more templates are found together

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5a795160d4a482669766be6266fa12d19298bc4b
Gerrit-PatchSet: 3
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for multiple templates

2016-10-31 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Support for multiple templates
..


Support for multiple templates

Bug: T148884
Change-Id: I5bde89e5422b392b420c04e659ea96a93cb6315b
---
M proveit.js
1 file changed, 47 insertions(+), 36 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index f19cae4..8e1b623 100755
--- a/proveit.js
+++ b/proveit.js
@@ -275,7 +275,7 @@
var i, j, reference, referenceItem;
for ( i = 0; i < matches.length; i++ ) {
// Turn all the matches into reference objects
-   reference = proveit.makeReference( matches[ i ] 
);
+   reference = proveit.parseReference( matches[ i 
] );
 
// For each reference, check the citations 
array for citations to it
for ( j = 0; j < citations.length; j++ ) {
@@ -311,8 +311,8 @@
 * @param {string} wikitext of the reference
 * @return {object} reference object
 */
-   makeReference: function ( referenceString ) {
-   // Extract the name, if any
+   parseReference: function ( referenceString ) {
+   // Extract the reference name, if any
// Three patterns: ,  and 
var referenceName = null,
match = referenceString.match( 
/<[\s]*ref[\s]*name[\s]*=[\s]*(?:(?:\"(.*?)\")|(?:\'(.*?)\')|(?:(.*?)))[\s]*>/i 
);
@@ -320,7 +320,7 @@
referenceName = match[1] || match[2] || match[3];
}
 
-   // Extract the index
+   // Get the index
var referenceIndex = proveit.getTextbox().val().indexOf( 
referenceString );
 
// Extract the content
@@ -334,31 +334,44 @@
'content': referenceContent
});
 
-   // Determine if the reference uses a template by getting all 
the registered template names and searching for a match
-   var registeredTemplatesArray = [];
-   for ( var registeredTemplate in proveit.templateData ) {
-   registeredTemplate = registeredTemplate.substring( 
registeredTemplate.indexOf( ':' ) + 1 ); // Remove the namespace
-   registeredTemplatesArray.push( registeredTemplate );
+   // Search for the main template of the reference
+   var templateName,
+   templateRegex,
+   indexStart;
+   for ( var templateTitle in proveit.templateData ) {
+   templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
+   templateRegex = new RegExp( '{{\\s*' + templateName, 
'i' );
+   indexStart = referenceContent.search( templateRegex );
+   if ( indexStart > -1 ) {
+   reference.template = templateName;
+   break;
+   }
}
-   var registeredTemplatesDisjunction = 
registeredTemplatesArray.join( '|' ),
-   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ); // We use [\s\S]* 
instead of .* to match newlines
-   match = referenceContent.match( regExp );
 
-   // If there's a match, add the template data to the reference
-   if ( match ) {
-   reference.templateString = match[0];
+   // The rest of the code is for when a main template was found
+   if ( reference.template ) {
 
-   // Extract and the template name and normalize it
-   var template = match[1];
-   registeredTemplatesArray.forEach( function ( 
registeredTemplate ) {
-   if ( template.toLowerCase() === 
registeredTemplate.toLowerCase() ) {
-   template = registeredTemplate;
+   // Figure out the indexEnd by searching for the closing 
"}}"
+   // knowing there may be subtemplates and other 
templates after the main template
+   var indexEnd = referenceContent.length,
+   templateLevel = 0;
+   for ( var i = indexStart; i < indexEnd; i++ ) {
+   if ( referenceContent[ i ] + referenceContent[ 
i + 1 ] === '{{' ) {
+   templateLevel++;
+   i++; // We speed up the loop to avoid 
multiple matches when two or more templates are found together
+   } else if ( referenceConten

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add Polish localization

2016-11-01 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add Polish localization
..

Add Polish localization

Also some code simplification

Bug: T149691
Change-Id: Icc1663e5c9656beaedc0b65fa2ef73687c559d47
---
A i18n/pl.json
M proveit.js
2 files changed, 29 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/91/319091/1

diff --git a/i18n/pl.json b/i18n/pl.json
new file mode 100644
index 000..44e8765
--- /dev/null
+++ b/i18n/pl.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Agnieszka Dul"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Dodaj",
+   "proveit-reference-name-label": "Tekstu źródłowego",
+   "proveit-reference-content-label": "Tekst źródłowy",
+   "proveit-reference-template-label": "Główny szablon",
+   "proveit-cite-button": "Cytat",
+   "proveit-remove-button": "Usuń",
+   "proveit-insert-button": "Wstawić",
+   "proveit-update-button": "Aktualizuj",
+   "proveit-prompt-name": "Aby cytować, należy podać autora tekstu 
źródłowego:",
+   "proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
+   "proveit-no-template": "Brak szablonu",
+   "proveit-no-references": "Nie znaleziono źródła"
+}
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index 16fa27f..85cb8f7 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
/**
 * Template data retrieved from the wiki
 *
-* @type {object} mapping template name to templateData
+* @type {object} mapping template title to templateData
 */
templateData: {},
 
@@ -335,13 +335,10 @@
});
 
// Search for the main template of the reference
-   var templateTitles = Object.keys( proveit.templateData 
).sort().reverse(), // Match "Cite books" before "Cite book"
-   templateTitle,
-   templateName,
+   var templateName,
templateRegex,
indexStart;
-   for ( var i = 0; i < templateTitles.length; i++ ) {
-   templateTitle = templateTitles[ i ];
+   for ( var templateTitle in proveit.templateData ) {
templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
templateRegex = new RegExp( '{{\\s*' + templateName + 
'[\\s|]', 'i' );
indexStart = referenceContent.search( templateRegex );
@@ -388,19 +385,19 @@
var paramArray = reference.templateString.substring( 2, 
reference.templateString.length - 2 ).split( '|' );
paramArray.shift(); // Get rid of the template name
 
-   var paramString, inLink = 0, inSubtemplate = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
+   var paramString, linkLevel = 0, subtemplateLevel = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
for ( i = 0; i < paramArray.length; i++ ) {
 
paramString = paramArray[ i ].trim();
 
// If we're inside a link or subtemplate, don't 
disturb it
-   if ( inLink || inSubtemplate ) {
+   if ( linkLevel || subtemplateLevel ) {
reference.params[ paramName ] += '|' + 
paramString;
if ( paramString.indexOf( ']]' ) > -1 ) 
{
-   inLink--;
+   linkLevel--;
}
if ( paramString.indexOf( '}}' ) > -1 ) 
{
-   inSubtemplate--;
+   subtemplateLevel--;
}
continue;
}
@@ -419,10 +416,10 @@
 
// Check if there's an unclosed link or 
subtemplate
if ( paramValue.indexOf( '[[' ) > -1 && 
paramValue.indexOf( ']]' ) === -1 ) {
-   inLink++;
+   linkLevel++;
}
if ( paramValue.indexOf( '{{' ) > -1 && 
paramValue.indexOf( '}}' ) === -1 ) {
-   inSubtemplate++;
+   subtemplateLevel++;
}
 
  

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add Polish localization

2016-11-01 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add Polish localization
..


Add Polish localization

Also some code simplification

Bug: T149691
Change-Id: Icc1663e5c9656beaedc0b65fa2ef73687c559d47
---
A i18n/pl.json
M proveit.js
2 files changed, 29 insertions(+), 12 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/pl.json b/i18n/pl.json
new file mode 100644
index 000..44e8765
--- /dev/null
+++ b/i18n/pl.json
@@ -0,0 +1,20 @@
+{
+   "@metadata": {
+   "authors": [
+   "Agnieszka Dul"
+   ]
+   },
+   "proveit-list-tab": "Lista ($1)",
+   "proveit-add-tab": "Dodaj",
+   "proveit-reference-name-label": "Tekstu źródłowego",
+   "proveit-reference-content-label": "Tekst źródłowy",
+   "proveit-reference-template-label": "Główny szablon",
+   "proveit-cite-button": "Cytat",
+   "proveit-remove-button": "Usuń",
+   "proveit-insert-button": "Wstawić",
+   "proveit-update-button": "Aktualizuj",
+   "proveit-prompt-name": "Aby cytować, należy podać autora tekstu 
źródłowego:",
+   "proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
+   "proveit-no-template": "Brak szablonu",
+   "proveit-no-references": "Nie znaleziono źródła"
+}
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index 16fa27f..85cb8f7 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
/**
 * Template data retrieved from the wiki
 *
-* @type {object} mapping template name to templateData
+* @type {object} mapping template title to templateData
 */
templateData: {},
 
@@ -335,13 +335,10 @@
});
 
// Search for the main template of the reference
-   var templateTitles = Object.keys( proveit.templateData 
).sort().reverse(), // Match "Cite books" before "Cite book"
-   templateTitle,
-   templateName,
+   var templateName,
templateRegex,
indexStart;
-   for ( var i = 0; i < templateTitles.length; i++ ) {
-   templateTitle = templateTitles[ i ];
+   for ( var templateTitle in proveit.templateData ) {
templateName = templateTitle.substring( 
templateTitle.indexOf( ':' ) + 1 ); // Remove the namespace
templateRegex = new RegExp( '{{\\s*' + templateName + 
'[\\s|]', 'i' );
indexStart = referenceContent.search( templateRegex );
@@ -388,19 +385,19 @@
var paramArray = reference.templateString.substring( 2, 
reference.templateString.length - 2 ).split( '|' );
paramArray.shift(); // Get rid of the template name
 
-   var paramString, inLink = 0, inSubtemplate = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
+   var paramString, linkLevel = 0, subtemplateLevel = 0, 
indexOfEqual, paramNumber = 0, paramName, paramValue;
for ( i = 0; i < paramArray.length; i++ ) {
 
paramString = paramArray[ i ].trim();
 
// If we're inside a link or subtemplate, don't 
disturb it
-   if ( inLink || inSubtemplate ) {
+   if ( linkLevel || subtemplateLevel ) {
reference.params[ paramName ] += '|' + 
paramString;
if ( paramString.indexOf( ']]' ) > -1 ) 
{
-   inLink--;
+   linkLevel--;
}
if ( paramString.indexOf( '}}' ) > -1 ) 
{
-   inSubtemplate--;
+   subtemplateLevel--;
}
continue;
}
@@ -419,10 +416,10 @@
 
// Check if there's an unclosed link or 
subtemplate
if ( paramValue.indexOf( '[[' ) > -1 && 
paramValue.indexOf( ']]' ) === -1 ) {
-   inLink++;
+   linkLevel++;
}
if ( paramValue.indexOf( '{{' ) > -1 && 
paramValue.indexOf( '}}' ) === -1 ) {
-   inSubtemplate++;
+   subtemplateLevel++;
}
 
reference.params[ paramName ] = paramValue;

-- 
To view, vi

[MediaWiki-commits] [Gerrit] mediawiki...WikipediaExtracts[master]: Requested fixes

2016-11-03 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Requested fixes
..

Requested fixes

- Break code into smaller methods
- Add error handling
- Build  with Html::rawElement
- Short array syntax
- Remove  from wikipediaextracts-credits
- Add Parser typehint
- Remove extract()
- API requests to formatversion=2
- Add user agent to API requests
- Validate language codes
- Remove  tag and duplicate code
- Declare public and private variables and methods
- Add \n to EOF

Bug: T149766
Change-Id: I1c1296c0381000c75ddfa2577bf5588343abdf72
---
M WikipediaExtracts.php
M extension.json
M i18n/ast.json
M i18n/bn.json
M i18n/de.json
M i18n/en.json
M i18n/es.json
M i18n/fr.json
M i18n/gl.json
M i18n/it.json
M i18n/ko.json
M i18n/lb.json
M i18n/lt.json
M i18n/mk.json
M i18n/pl.json
M i18n/pt.json
M i18n/qqq.json
M i18n/ru.json
M i18n/sv.json
M i18n/zh-hans.json
20 files changed, 215 insertions(+), 165 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikipediaExtracts 
refs/changes/86/319786/1

diff --git a/WikipediaExtracts.php b/WikipediaExtracts.php
index cdfa55a..201bfb2 100644
--- a/WikipediaExtracts.php
+++ b/WikipediaExtracts.php
@@ -2,174 +2,219 @@
 
 class WikipediaExtracts {
 
-   static function onParserFirstCallInit( &$parser ) {
-   $parser->setHook( 'WikipediaExtract', 
'WikipediaExtracts::onHook' );
+   /**
+* Parser object
+*/
+   private static $parser;
+
+   /**
+* Language code of the local wiki
+*/
+   public static $contentLanguage;
+
+   /**
+* Associative array of the parameters passed to the parser function
+*/
+   private static $params;
+
+   /**
+* Title of the Wikipedia article to extract
+*/
+   private static $wikipediaTitle;
+
+   /**
+* Language code of the Wikipedia to query
+*/
+   private static $wikipediaLanguage;
+
+   /**
+* Existing Wikipedia language codes
+*/
+   private static $wikipediaLanguages = 
['ace','af','ak','als','an','roa-rup','frp','ast','gn','ay','az','bjn','id','ms','bm','zh-min-nan','map-bms','jv','min','su','bug','bcl','bi','bar','bs','br','ca','ceb','cs','ch','cbk-zam','ny','sn','tum','co','cy','da','pdc','de','nv','dsb','na','lad','et','eml','ang','en','es','eo','ext','eu','ee','to','hif','fo','fr','fy','ff','fur','ga','gv','sm','gag','gd','gl','ki','haw','hsb','hr','io','ig','rw','ilo','ia','ie','ik','xh','zu','is','it','kl','pam','csb','kw','kg','rn','sw','ht','ku','ltg','la','lv','lb','lt','lij','li','ln','jbo','lg','lmo','hu','mg','mt','mi','cdo','mwl','fj','nah','nl','nds-nl','cr','nap','frr','pih','no','nrm','nov','nn','uz','oc','om','pfl','pag','pap','pcd','pms','nds','pl','pt','kaa','crh','ty','ksh','ro','rmy','rm','qu','se','sg','sc','sco','stq','nso','st','tn','sq','scn','simple','ss','sk','sl','szl','so','srn','sh','fi','sv','tl','kab','roa-tara','tt','tet','vi','tpi','chy','ve','tr','tk','tw','za','vec','vep','vo','fiu-vro','wa','vls','war','wo','ts','yo','diq','zea','bat-smg','el','pnt','av','kbd','ab','ba','be','тарашкевіца','be-tarask','bxr','bg','os','kv','krc','ky','mrj','kk','lbe','lez','mk','mdf','mn','ce','mhr','koi','rue','ru','sah','cu','sr','tg','tyv','udm','uk','xal','cv','myv','hy','xmf','ka','got','yi','he','ur','ar','ps','sd','pnb','fa','glk','mzn','arz','azb','ha','lrc','ug','ckb','arc','dv','ks','new','ne','pi','bh','gom','mai','mr','sa','hi','as','bpy','bn','pa','gu','or','ta','te','kn','ml','si','th','my','dz','bo','lo','km','iu','chr','ti','am','ko','zh','zh-classical','wuu','hak','ja','zh-yue','gan'];
+
+   /**
+* Main hook
+*/
+   public static function onParserFirstCallInit( Parser &$parser ) {
$parser->setFunctionHook( 'WikipediaExtract', 
'WikipediaExtracts::onFunctionHook' );
-   return true;
}
 
-   static function onHook( $input, array $args, Parser $parser, PPFrame 
$frame ) {
-   // Set the defaults
-   $title = $parser->getTitle()->getRootText();
-   $language = $parser->getTargetLanguage()->getCode();
-   $chars = null;
-   $sentences = null;
-   $limit = null;
-   $intro = null;
-   $plaintext = null;
-   $sectionformat = null;
-   $continue = null;
-   $variant = null;
+   /**
+* Parser function hook
+*/
+   public static function onFunctionHook( Parser $parser, $input = null ) {
+   try {
+   self::$parser = $parser;
+   self::$contentLanguage = $parser->getTargetLanguage();
+   self::$params = self::parseParams( array_slice( 
func_get_args(), 2 ) );
+   self::$wikipediaTitle = self::getWikipediaTitle(

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Correct Polish translations

2016-11-05 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Correct Polish translations
..


Correct Polish translations

Change-Id: I71fc7f9c100cce39a25b1341ab5aee071b34da55
---
M i18n/pl.json
1 file changed, 19 insertions(+), 18 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/pl.json b/i18n/pl.json
index 44e8765..711972f 100644
--- a/i18n/pl.json
+++ b/i18n/pl.json
@@ -1,20 +1,21 @@
 {
-   "@metadata": {
-   "authors": [
-   "Agnieszka Dul"
-   ]
-   },
-   "proveit-list-tab": "Lista ($1)",
-   "proveit-add-tab": "Dodaj",
-   "proveit-reference-name-label": "Tekstu źródłowego",
-   "proveit-reference-content-label": "Tekst źródłowy",
-   "proveit-reference-template-label": "Główny szablon",
-   "proveit-cite-button": "Cytat",
-   "proveit-remove-button": "Usuń",
-   "proveit-insert-button": "Wstawić",
-   "proveit-update-button": "Aktualizuj",
-   "proveit-prompt-name": "Aby cytować, należy podać autora tekstu 
źródłowego:",
-   "proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
-   "proveit-no-template": "Brak szablonu",
-   "proveit-no-references": "Nie znaleziono źródła"
+"@metadata": {
+"authors": [
+"Agnieszka Dul",
+"Michał Sobkowski"
+]
+},
+"proveit-list-tab": "Lista ($1)",
+"proveit-add-tab": "Dodaj",
+"proveit-reference-name-label": "Nazwa przypisu",
+"proveit-reference-content-label": "Kod źródłowy przypisu",
+"proveit-reference-template-label": "Główny szablon",
+"proveit-cite-button": "Wstaw przypis",
+"proveit-remove-button": "Usuń",
+"proveit-insert-button": "Wstaw",
+"proveit-update-button": "Aktualizuj",
+"proveit-prompt-name": "Ten przypis nie ma jeszcze nazwy. Zdefiniuj ją 
tutaj:",
+"proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
+"proveit-no-template": "Brak szablonu",
+"proveit-no-references": "Nie znaleziono źródła"
 }
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I71fc7f9c100cce39a25b1341ab5aee071b34da55
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Correct Polish translations

2016-11-05 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Correct Polish translations
..

Correct Polish translations

Change-Id: I71fc7f9c100cce39a25b1341ab5aee071b34da55
---
M i18n/pl.json
1 file changed, 19 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/03/320003/1

diff --git a/i18n/pl.json b/i18n/pl.json
index 44e8765..711972f 100644
--- a/i18n/pl.json
+++ b/i18n/pl.json
@@ -1,20 +1,21 @@
 {
-   "@metadata": {
-   "authors": [
-   "Agnieszka Dul"
-   ]
-   },
-   "proveit-list-tab": "Lista ($1)",
-   "proveit-add-tab": "Dodaj",
-   "proveit-reference-name-label": "Tekstu źródłowego",
-   "proveit-reference-content-label": "Tekst źródłowy",
-   "proveit-reference-template-label": "Główny szablon",
-   "proveit-cite-button": "Cytat",
-   "proveit-remove-button": "Usuń",
-   "proveit-insert-button": "Wstawić",
-   "proveit-update-button": "Aktualizuj",
-   "proveit-prompt-name": "Aby cytować, należy podać autora tekstu 
źródłowego:",
-   "proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
-   "proveit-no-template": "Brak szablonu",
-   "proveit-no-references": "Nie znaleziono źródła"
+"@metadata": {
+"authors": [
+"Agnieszka Dul",
+"Michał Sobkowski"
+]
+},
+"proveit-list-tab": "Lista ($1)",
+"proveit-add-tab": "Dodaj",
+"proveit-reference-name-label": "Nazwa przypisu",
+"proveit-reference-content-label": "Kod źródłowy przypisu",
+"proveit-reference-template-label": "Główny szablon",
+"proveit-cite-button": "Wstaw przypis",
+"proveit-remove-button": "Usuń",
+"proveit-insert-button": "Wstaw",
+"proveit-update-button": "Aktualizuj",
+"proveit-prompt-name": "Ten przypis nie ma jeszcze nazwy. Zdefiniuj ją 
tutaj:",
+"proveit-confirm-remove": "Zostanie usunięte źródło i wszystkie cytaty. 
czy jesteś pewien?",
+"proveit-no-template": "Brak szablonu",
+"proveit-no-references": "Nie znaleziono źródła"
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71fc7f9c100cce39a25b1341ab5aee071b34da55
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add russian localisation

2016-10-11 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add russian localisation
..

Add russian localisation

Thanks to Iniquity for the translation.
Also a minor bugfix.

Change-Id: I48160b9d806d60a6fb8caaad47cb5ef77262095f
---
M proveit.js
1 file changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/66/315266/1

diff --git a/proveit.js b/proveit.js
index 83e7a78..3c74a24 100755
--- a/proveit.js
+++ b/proveit.js
@@ -55,6 +55,22 @@
'proveit-confirm-remove': 'Esto borrará la referencia y 
todas sus citas. ¿Estás seguro?',
'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
+   },
+   'ru': {
+   'proveit-edit-tab': 'Править',
+   'proveit-add-tab': 'Добавить',
+   'proveit-reference-name-label': 'Имя сноски',
+   'proveit-reference-content-label': 'Содержание сноски',
+   'proveit-reference-template-label': 'Основной шаблон',
+   'proveit-params-button': 'Показать все параметры',
+   'proveit-cite-button': 'Цитировать',
+   'proveit-remove-button': 'Удалить',
+   'proveit-insert-button': 'Вставить',
+   'proveit-update-button': 'Обновить',
+   'proveit-prompt-name': 'Источнику нужно задать имя, 
чтобы его процитировать:',
+   'proveit-confirm-remove': 'Будет удален источник и все 
его цитаты. Вы уверены?',
+   'proveit-no-template': 'Нет шаблона',
+   'proveit-no-references': 'Источники не найдены'
}
},
 
@@ -331,8 +347,8 @@
registeredTemplatesArray.push( registeredTemplate );
}
var registeredTemplatesDisjunction = 
registeredTemplatesArray.join( '|' ),
-   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ), // We use [\s\S]* 
instead of .* to match newlines
-   match = referenceContent.match( regExp );
+   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ); // We use [\s\S]* 
instead of .* to match newlines
+   match = referenceContent.match( regExp );
 
// If there's a match, add the template data to the reference
if ( match ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48160b9d806d60a6fb8caaad47cb5ef77262095f
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add russian localisation

2016-10-11 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add russian localisation
..


Add russian localisation

Thanks to Iniquity for the translation.
Also a minor bugfix.

Change-Id: I48160b9d806d60a6fb8caaad47cb5ef77262095f
---
M proveit.js
1 file changed, 18 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 83e7a78..3c74a24 100755
--- a/proveit.js
+++ b/proveit.js
@@ -55,6 +55,22 @@
'proveit-confirm-remove': 'Esto borrará la referencia y 
todas sus citas. ¿Estás seguro?',
'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
+   },
+   'ru': {
+   'proveit-edit-tab': 'Править',
+   'proveit-add-tab': 'Добавить',
+   'proveit-reference-name-label': 'Имя сноски',
+   'proveit-reference-content-label': 'Содержание сноски',
+   'proveit-reference-template-label': 'Основной шаблон',
+   'proveit-params-button': 'Показать все параметры',
+   'proveit-cite-button': 'Цитировать',
+   'proveit-remove-button': 'Удалить',
+   'proveit-insert-button': 'Вставить',
+   'proveit-update-button': 'Обновить',
+   'proveit-prompt-name': 'Источнику нужно задать имя, 
чтобы его процитировать:',
+   'proveit-confirm-remove': 'Будет удален источник и все 
его цитаты. Вы уверены?',
+   'proveit-no-template': 'Нет шаблона',
+   'proveit-no-references': 'Источники не найдены'
}
},
 
@@ -331,8 +347,8 @@
registeredTemplatesArray.push( registeredTemplate );
}
var registeredTemplatesDisjunction = 
registeredTemplatesArray.join( '|' ),
-   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ), // We use [\s\S]* 
instead of .* to match newlines
-   match = referenceContent.match( regExp );
+   regExp = new RegExp( '{{(' + 
registeredTemplatesDisjunction + ')([\\s\\S]*)}}', 'i' ); // We use [\s\S]* 
instead of .* to match newlines
+   match = referenceContent.match( regExp );
 
// If there's a match, add the template data to the reference
if ( match ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I48160b9d806d60a6fb8caaad47cb5ef77262095f
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for parameter aliases

2016-10-13 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Support for parameter aliases
..

Support for parameter aliases

And some minor tweaks

Change-Id: Ic118b05acd281158bc9d9f74cd66921cfe55339e
---
M proveit.css
M proveit.js
2 files changed, 25 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/46/315746/1

diff --git a/proveit.css b/proveit.css
index dc4762e..8f5ea12 100755
--- a/proveit.css
+++ b/proveit.css
@@ -25,7 +25,7 @@
margin-left: 5px;
 }
 
-#proveit-edit-tab,
+#proveit-list-tab,
 #proveit-add-tab {
color: black;
cursor: pointer;
@@ -34,7 +34,7 @@
padding: 15px;
 }
 
-#proveit-edit-tab.active,
+#proveit-list-tab.active,
 #proveit-add-tab.active {
background: #a7dcff;
 }
diff --git a/proveit.js b/proveit.js
index 3c74a24..d3108e0 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
 */
messages: {
'en': {
-   'proveit-edit-tab': 'Edit',
+   'proveit-list-tab': 'List',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
@@ -41,7 +41,7 @@
'proveit-no-references': 'No references found'
},
'es': {
-   'proveit-edit-tab': 'Editar',
+   'proveit-list-tab': 'Lista',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
@@ -57,7 +57,7 @@
'proveit-no-references': 'No se han encontrado 
referencias'
},
'ru': {
-   'proveit-edit-tab': 'Править',
+   'proveit-list-tab': 'Список',
'proveit-add-tab': 'Добавить',
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
@@ -187,13 +187,13 @@
logo = $( '' ).attr( 'id', 'proveit-logo' ).text( 
'ProveIt' ),
leftBracket = $( '' ).attr( 'id', 
'proveit-left-bracket' ).text( '[' ),
rightBracket = $( '' ).attr( 'id', 
'proveit-right-bracket' ).text( ']' ),
-   editTab = $( '' ).attr( 'id', 'proveit-edit-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'edit-tab' ) ),
+   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab' ) ),
addTab = $( '' ).attr( 'id', 'proveit-add-tab' 
).text( proveit.getMessage( 'add-tab' ) ),
content = $( '' ).attr( 'id', 'proveit-content' );
 
// Put everything together and add it to the DOM
logo.prepend( leftBracket ).append( rightBracket );
-   header.append( logo, editTab, addTab );
+   header.append( logo, listTab, addTab );
gui.append( header, content );
$( 'body' ).prepend( gui );
 
@@ -221,7 +221,7 @@
dragged = false; // Reset the flag
return;
}
-   editTab.toggle();
+   listTab.toggle();
addTab.toggle();
content.toggle();
gui.css({
@@ -232,7 +232,7 @@
});
}).click(); // Click the logo to hide the gadget by default
 
-   editTab.click( function () {
+   listTab.click( function () {
if ( dragged ) {
dragged = false; // Reset the flag
return;
@@ -422,7 +422,7 @@
if ( currentSummary.indexOf( 'ProveIt' ) > -1 ) {
return; // Don't add it twice
}
-   $( '#wpSummary' ).val( currentSummary ? currentSummary + ' - ' 
+ proveitSummary : proveitSummary );
+   $( '#wpSummary' ).val( currentSummary ? currentSummary + 
proveitSummary : proveitSummary );
},
 
/**
@@ -536,6 +536,7 @@
 *
 * This object is constructed directly out of the wikitext, so 
it doesn't include
 * any information about the parameters other than their names 
and values.
+* Also the parameter names here may be aliases.
 */
this.params = {};
 
@@ -695,7 +696,7 @@
reference.index = textbox.val().

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for parameter aliases

2016-10-13 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Support for parameter aliases
..


Support for parameter aliases

And some minor tweaks

Change-Id: Ic118b05acd281158bc9d9f74cd66921cfe55339e
---
M proveit.css
M proveit.js
2 files changed, 25 insertions(+), 13 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index dc4762e..8f5ea12 100755
--- a/proveit.css
+++ b/proveit.css
@@ -25,7 +25,7 @@
margin-left: 5px;
 }
 
-#proveit-edit-tab,
+#proveit-list-tab,
 #proveit-add-tab {
color: black;
cursor: pointer;
@@ -34,7 +34,7 @@
padding: 15px;
 }
 
-#proveit-edit-tab.active,
+#proveit-list-tab.active,
 #proveit-add-tab.active {
background: #a7dcff;
 }
diff --git a/proveit.js b/proveit.js
index 3c74a24..d3108e0 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
 */
messages: {
'en': {
-   'proveit-edit-tab': 'Edit',
+   'proveit-list-tab': 'List',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
@@ -41,7 +41,7 @@
'proveit-no-references': 'No references found'
},
'es': {
-   'proveit-edit-tab': 'Editar',
+   'proveit-list-tab': 'Lista',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
@@ -57,7 +57,7 @@
'proveit-no-references': 'No se han encontrado 
referencias'
},
'ru': {
-   'proveit-edit-tab': 'Править',
+   'proveit-list-tab': 'Список',
'proveit-add-tab': 'Добавить',
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
@@ -187,13 +187,13 @@
logo = $( '' ).attr( 'id', 'proveit-logo' ).text( 
'ProveIt' ),
leftBracket = $( '' ).attr( 'id', 
'proveit-left-bracket' ).text( '[' ),
rightBracket = $( '' ).attr( 'id', 
'proveit-right-bracket' ).text( ']' ),
-   editTab = $( '' ).attr( 'id', 'proveit-edit-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'edit-tab' ) ),
+   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab' ) ),
addTab = $( '' ).attr( 'id', 'proveit-add-tab' 
).text( proveit.getMessage( 'add-tab' ) ),
content = $( '' ).attr( 'id', 'proveit-content' );
 
// Put everything together and add it to the DOM
logo.prepend( leftBracket ).append( rightBracket );
-   header.append( logo, editTab, addTab );
+   header.append( logo, listTab, addTab );
gui.append( header, content );
$( 'body' ).prepend( gui );
 
@@ -221,7 +221,7 @@
dragged = false; // Reset the flag
return;
}
-   editTab.toggle();
+   listTab.toggle();
addTab.toggle();
content.toggle();
gui.css({
@@ -232,7 +232,7 @@
});
}).click(); // Click the logo to hide the gadget by default
 
-   editTab.click( function () {
+   listTab.click( function () {
if ( dragged ) {
dragged = false; // Reset the flag
return;
@@ -422,7 +422,7 @@
if ( currentSummary.indexOf( 'ProveIt' ) > -1 ) {
return; // Don't add it twice
}
-   $( '#wpSummary' ).val( currentSummary ? currentSummary + ' - ' 
+ proveitSummary : proveitSummary );
+   $( '#wpSummary' ).val( currentSummary ? currentSummary + 
proveitSummary : proveitSummary );
},
 
/**
@@ -536,6 +536,7 @@
 *
 * This object is constructed directly out of the wikitext, so 
it doesn't include
 * any information about the parameters other than their names 
and values.
+* Also the parameter names here may be aliases.
 */
this.params = {};
 
@@ -695,7 +696,7 @@
reference.index = textbox.val().indexOf( 
reference.string );
 
// Switch 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for aliases

2016-10-13 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Support for aliases
..

Support for aliases

Also improved display in List mode

Change-Id: Ic9eed2fb4847893670f068b16a3861517d16b79b
---
M proveit.css
M proveit.js
2 files changed, 34 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/75/315875/1

diff --git a/proveit.css b/proveit.css
index 8f5ea12..9dc76dd 100755
--- a/proveit.css
+++ b/proveit.css
@@ -78,7 +78,7 @@
font-weight: bold;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-required-param-value {
+#proveit-reference-list .proveit-reference-item .proveit-param-value {
margin-left: 10px;
 }
 
diff --git a/proveit.js b/proveit.js
index d3108e0..ad93917 100755
--- a/proveit.js
+++ b/proveit.js
@@ -30,7 +30,6 @@
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
'proveit-reference-template-label': 'Main template',
-   'proveit-params-button': 'Show all parameters',
'proveit-cite-button': 'Cite',
'proveit-remove-button': 'Remove',
'proveit-insert-button': 'Insert',
@@ -46,7 +45,6 @@
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
'proveit-reference-template-label': 'Plantilla 
principal',
-   'proveit-params-button': 'Ver todos los parámetros',
'proveit-cite-button': 'Citar',
'proveit-remove-button': 'Borrar',
'proveit-insert-button': 'Insertar',
@@ -62,7 +60,6 @@
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
'proveit-reference-template-label': 'Основной шаблон',
-   'proveit-params-button': 'Показать все параметры',
'proveit-cite-button': 'Цитировать',
'proveit-remove-button': 'Удалить',
'proveit-insert-button': 'Вставить',
@@ -541,19 +538,6 @@
this.params = {};
 
/**
-* Show all the hidden optional parameters
-*
-* @return {void}
-*/
-   this.showAllParams = function () {
-   var button = $( this ),
-   form = button.closest( 'form' ),
-   rows = $( 'tr', form );
-   rows.show();
-   button.hide();
-   };
-
-   /**
 * Insert a citation to this reference
 *
 * @return {void}
@@ -819,14 +803,38 @@
 
// Add the main content
if ( this.template ) {
-   var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template ),
-   requiredParams = 
this.getRequiredParams(),
-   requiredParamName, requiredParamValue, 
requiredParamSpan;
+   // First add the template name
+   var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template );
item.html( templateSpan );
-   for ( requiredParamName in requiredParams ) {
-   requiredParamValue = this.params[ 
requiredParamName ];
-   requiredParamSpan = $( '' 
).addClass( 'proveit-required-param-value' ).text( requiredParamValue );
-   item.append( requiredParamSpan );
+
+   // Search the values of the first three 
parameters and add them to the list item
+   // We search for the first three values rather 
than the required ones because
+   // some tempalates (like Template:Citation) 
don't have any required parameters
+   // but we sort the parameters to give priority 
to the required parameters
+   var sortedParams = this.getSortedParams(),
+   paramCount = 0, paramValue, paramData, 
paramAlias, paramSpan;
+   for ( var paramName in sortedParams ) {
+   paramValue = '';
+   if ( paramName in this.params ) {

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Support for aliases

2016-10-13 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Support for aliases
..


Support for aliases

Also improved display in List mode

Change-Id: Ic9eed2fb4847893670f068b16a3861517d16b79b
---
M proveit.css
M proveit.js
2 files changed, 34 insertions(+), 36 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index 8f5ea12..9dc76dd 100755
--- a/proveit.css
+++ b/proveit.css
@@ -78,7 +78,7 @@
font-weight: bold;
 }
 
-#proveit-reference-list .proveit-reference-item .proveit-required-param-value {
+#proveit-reference-list .proveit-reference-item .proveit-param-value {
margin-left: 10px;
 }
 
diff --git a/proveit.js b/proveit.js
index d3108e0..ad93917 100755
--- a/proveit.js
+++ b/proveit.js
@@ -30,7 +30,6 @@
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
'proveit-reference-template-label': 'Main template',
-   'proveit-params-button': 'Show all parameters',
'proveit-cite-button': 'Cite',
'proveit-remove-button': 'Remove',
'proveit-insert-button': 'Insert',
@@ -46,7 +45,6 @@
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
'proveit-reference-template-label': 'Plantilla 
principal',
-   'proveit-params-button': 'Ver todos los parámetros',
'proveit-cite-button': 'Citar',
'proveit-remove-button': 'Borrar',
'proveit-insert-button': 'Insertar',
@@ -62,7 +60,6 @@
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
'proveit-reference-template-label': 'Основной шаблон',
-   'proveit-params-button': 'Показать все параметры',
'proveit-cite-button': 'Цитировать',
'proveit-remove-button': 'Удалить',
'proveit-insert-button': 'Вставить',
@@ -541,19 +538,6 @@
this.params = {};
 
/**
-* Show all the hidden optional parameters
-*
-* @return {void}
-*/
-   this.showAllParams = function () {
-   var button = $( this ),
-   form = button.closest( 'form' ),
-   rows = $( 'tr', form );
-   rows.show();
-   button.hide();
-   };
-
-   /**
 * Insert a citation to this reference
 *
 * @return {void}
@@ -819,14 +803,38 @@
 
// Add the main content
if ( this.template ) {
-   var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template ),
-   requiredParams = 
this.getRequiredParams(),
-   requiredParamName, requiredParamValue, 
requiredParamSpan;
+   // First add the template name
+   var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template );
item.html( templateSpan );
-   for ( requiredParamName in requiredParams ) {
-   requiredParamValue = this.params[ 
requiredParamName ];
-   requiredParamSpan = $( '' 
).addClass( 'proveit-required-param-value' ).text( requiredParamValue );
-   item.append( requiredParamSpan );
+
+   // Search the values of the first three 
parameters and add them to the list item
+   // We search for the first three values rather 
than the required ones because
+   // some tempalates (like Template:Citation) 
don't have any required parameters
+   // but we sort the parameters to give priority 
to the required parameters
+   var sortedParams = this.getSortedParams(),
+   paramCount = 0, paramValue, paramData, 
paramAlias, paramSpan;
+   for ( var paramName in sortedParams ) {
+   paramValue = '';
+   if ( paramName in this.params ) {
+   paramValue = this.

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add reference numbers

2016-10-14 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add reference numbers
..

Add reference numbers

In the list tab, prepend the reference number to each list item

Change-Id: I6652bb7d286e618bbf39aaecf2ed439dc651a88c
---
M proveit.css
M proveit.js
2 files changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/57/315957/1

diff --git a/proveit.css b/proveit.css
index 9dc76dd..a04a98a 100755
--- a/proveit.css
+++ b/proveit.css
@@ -50,7 +50,6 @@
 }
 
 #proveit-reference-list {
-   list-style: none;
margin: 0;
padding: 0;
 }
@@ -74,6 +73,10 @@
cursor: pointer;
 }
 
+#proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   margin-right: 10px;
+}
+
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
 }
diff --git a/proveit.js b/proveit.js
index ad93917..fac1f5c 100755
--- a/proveit.js
+++ b/proveit.js
@@ -266,7 +266,7 @@
scanForReferences: function () {
 
// First define the list element
-   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
+   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
 
// Second, look for all the citations in the wikitext and store 
them in an array for later
var wikitext = proveit.getTextbox().val(),
@@ -299,6 +299,12 @@
 
// Finally, turn all the references into list 
items and insert them into the reference list
referenceItem = reference.toListItem();
+
+   // Add the reference number
+   // We don't use the  numbers because of 
stying reasons
+   referenceItem.prepend( $( '' ).addClass( 
'proveit-reference-number' ).text( i + 1 ) );
+
+   // Add the item to the list
referenceList.append( referenceItem );
}
 
@@ -803,6 +809,7 @@
 
// Add the main content
if ( this.template ) {
+
// First add the template name
var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template );
item.html( templateSpan );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6652bb7d286e618bbf39aaecf2ed439dc651a88c
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add reference numbers

2016-10-14 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add reference numbers
..


Add reference numbers

In the list tab, prepend the reference number to each list item

Change-Id: I6652bb7d286e618bbf39aaecf2ed439dc651a88c
---
M proveit.css
M proveit.js
2 files changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index 9dc76dd..a04a98a 100755
--- a/proveit.css
+++ b/proveit.css
@@ -50,7 +50,6 @@
 }
 
 #proveit-reference-list {
-   list-style: none;
margin: 0;
padding: 0;
 }
@@ -74,6 +73,10 @@
cursor: pointer;
 }
 
+#proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   margin-right: 10px;
+}
+
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
 }
diff --git a/proveit.js b/proveit.js
index ad93917..fac1f5c 100755
--- a/proveit.js
+++ b/proveit.js
@@ -266,7 +266,7 @@
scanForReferences: function () {
 
// First define the list element
-   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
+   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
 
// Second, look for all the citations in the wikitext and store 
them in an array for later
var wikitext = proveit.getTextbox().val(),
@@ -299,6 +299,12 @@
 
// Finally, turn all the references into list 
items and insert them into the reference list
referenceItem = reference.toListItem();
+
+   // Add the reference number
+   // We don't use the  numbers because of 
stying reasons
+   referenceItem.prepend( $( '' ).addClass( 
'proveit-reference-number' ).text( i + 1 ) );
+
+   // Add the item to the list
referenceList.append( referenceItem );
}
 
@@ -803,6 +809,7 @@
 
// Add the main content
if ( this.template ) {
+
// First add the template name
var templateSpan = $( '' ).addClass( 
'proveit-reference-template' ).text( this.template );
item.html( templateSpan );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6652bb7d286e618bbf39aaecf2ed439dc651a88c
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Distinguish between content language and user language

2016-10-15 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Distinguish between content language and user language
..

Distinguish between content language and user language

Interface language should be based on the user language,
but the language of the labels and parameters on the content
language.

Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
---
M proveit.css
M proveit.js
2 files changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/72/316072/1

diff --git a/proveit.css b/proveit.css
index a04a98a..e809606 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,15 +74,18 @@
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   font-weight: bold;
margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-param-value {
-   margin-left: 10px;
+   display: inline-block;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-citations {
diff --git a/proveit.js b/proveit.js
index fac1f5c..9502207 100755
--- a/proveit.js
+++ b/proveit.js
@@ -86,6 +86,13 @@
userLanguage: 'en',
 
/**
+* Content language (may be different from the user language)
+*
+* @type {string} defaults to English
+*/
+   contentLanguage: 'en',
+
+   /**
 * Convenience method to get a ProveIt option
 *
 * @param {string} option key without the "proveit-" prefix
@@ -126,7 +133,13 @@
if ( userLanguage in proveit.messages ) {
proveit.userLanguage = userLanguage;
}
-   mw.messages.set( proveit.messages[ userLanguage ] );
+   mw.messages.set( proveit.messages[ proveit.userLanguage ] );
+
+   // Set the content language
+   var contentLanguage = mw.config.get( 'wgContentLanguage' );
+   if ( contentLanguage ) {
+   proveit.contentLanguage = contentLanguage;
+   }
 
// Build the interface
proveit.build();
@@ -932,7 +945,7 @@
 
// Override with template data
if ( paramData.label ) {
-   paramLabel = paramData.label[ 
proveit.userLanguage ];
+   paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
// If the parameter is a date, put the current 
date as a placeholder
@@ -946,7 +959,7 @@
}
 
if ( paramData.description ) {
-   paramDescription = 
paramData.description[ proveit.userLanguage ];
+   paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
 
// Extract the parameter value

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Distinguish between content language and user language

2016-10-15 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Distinguish between content language and user language
..


Distinguish between content language and user language

Interface language should be based on the user language,
but the language of the labels and parameters on the content
language.

Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
---
M proveit.css
M proveit.js
2 files changed, 20 insertions(+), 4 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index a04a98a..e809606 100755
--- a/proveit.css
+++ b/proveit.css
@@ -74,15 +74,18 @@
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-number {
+   font-weight: bold;
margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-reference-template {
font-weight: bold;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-param-value {
-   margin-left: 10px;
+   display: inline-block;
+   margin-right: 10px;
 }
 
 #proveit-reference-list .proveit-reference-item .proveit-citations {
diff --git a/proveit.js b/proveit.js
index fac1f5c..9502207 100755
--- a/proveit.js
+++ b/proveit.js
@@ -86,6 +86,13 @@
userLanguage: 'en',
 
/**
+* Content language (may be different from the user language)
+*
+* @type {string} defaults to English
+*/
+   contentLanguage: 'en',
+
+   /**
 * Convenience method to get a ProveIt option
 *
 * @param {string} option key without the "proveit-" prefix
@@ -126,7 +133,13 @@
if ( userLanguage in proveit.messages ) {
proveit.userLanguage = userLanguage;
}
-   mw.messages.set( proveit.messages[ userLanguage ] );
+   mw.messages.set( proveit.messages[ proveit.userLanguage ] );
+
+   // Set the content language
+   var contentLanguage = mw.config.get( 'wgContentLanguage' );
+   if ( contentLanguage ) {
+   proveit.contentLanguage = contentLanguage;
+   }
 
// Build the interface
proveit.build();
@@ -932,7 +945,7 @@
 
// Override with template data
if ( paramData.label ) {
-   paramLabel = paramData.label[ 
proveit.userLanguage ];
+   paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
// If the parameter is a date, put the current 
date as a placeholder
@@ -946,7 +959,7 @@
}
 
if ( paramData.description ) {
-   paramDescription = 
paramData.description[ proveit.userLanguage ];
+   paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
 
// Extract the parameter value

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c4b450204bc270b26f271772b1c0c4ff68b9d6a
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add French localization

2016-10-16 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add French localization
..

Add French localization

Thanks to Bastenbas

Change-Id: I663e5a3b34c224a33df145a2dca92f22d018bc48
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/29/316229/1

diff --git a/proveit.js b/proveit.js
index 9502207..7392b14 100755
--- a/proveit.js
+++ b/proveit.js
@@ -54,6 +54,21 @@
'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
},
+   'fr': {
+   'proveit-list-tab': 'Lister',
+   'proveit-add-tab': 'Ajouter',
+   'proveit-reference-name-label': 'Nom de la référence',
+   'proveit-reference-content-label': 'Contenu de la 
référence',
+   'proveit-reference-template-label': 'Modèle de 
présentation',
+   'proveit-cite-button': 'Réutiliser',
+   'proveit-remove-button': 'Supprimer',
+   'proveit-insert-button': 'Insérer',
+   'proveit-update-button': 'Mettre à jour',
+   'proveit-prompt-name': "La référence a besoin d'un nom 
pour être réutilisée:",
+   'proveit-confirm-remove': "Cela supprimera la référence 
dans tout l'article. Êtes-vous sûr?",
+   'proveit-no-template': 'Aucun modèle',
+   'proveit-no-references': 'Aucune référence trouvée'
+   },
'ru': {
'proveit-list-tab': 'Список',
'proveit-add-tab': 'Добавить',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I663e5a3b34c224a33df145a2dca92f22d018bc48
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add French localization

2016-10-16 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add French localization
..


Add French localization

Thanks to Bastenbas

Change-Id: I663e5a3b34c224a33df145a2dca92f22d018bc48
---
M proveit.js
1 file changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 9502207..7392b14 100755
--- a/proveit.js
+++ b/proveit.js
@@ -54,6 +54,21 @@
'proveit-no-template': 'Sin plantilla',
'proveit-no-references': 'No se han encontrado 
referencias'
},
+   'fr': {
+   'proveit-list-tab': 'Lister',
+   'proveit-add-tab': 'Ajouter',
+   'proveit-reference-name-label': 'Nom de la référence',
+   'proveit-reference-content-label': 'Contenu de la 
référence',
+   'proveit-reference-template-label': 'Modèle de 
présentation',
+   'proveit-cite-button': 'Réutiliser',
+   'proveit-remove-button': 'Supprimer',
+   'proveit-insert-button': 'Insérer',
+   'proveit-update-button': 'Mettre à jour',
+   'proveit-prompt-name': "La référence a besoin d'un nom 
pour être réutilisée:",
+   'proveit-confirm-remove': "Cela supprimera la référence 
dans tout l'article. Êtes-vous sûr?",
+   'proveit-no-template': 'Aucun modèle',
+   'proveit-no-references': 'Aucune référence trouvée'
+   },
'ru': {
'proveit-list-tab': 'Список',
'proveit-add-tab': 'Добавить',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I663e5a3b34c224a33df145a2dca92f22d018bc48
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add reference count

2016-10-17 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add reference count
..


Add reference count

Also an exception for the way quotes are displayed

Change-Id: I5230ef9846035b4ff73a0eeffb148124d7b57ac8
---
M proveit.css
M proveit.js
2 files changed, 16 insertions(+), 13 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index e809606..8d006bf 100755
--- a/proveit.css
+++ b/proveit.css
@@ -60,10 +60,6 @@
padding: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item:nth-child(odd) {
-   background: #f4f4f4;
-}
-
 #proveit-reference-list .proveit-reference-item:nth-child(even) {
background: #fff;
 }
@@ -117,7 +113,7 @@
display: table-cell;
padding: 5px;
vertical-align: top;
-   width: 200px;
+   width: 180px;
 }
 
 #proveit-reference-form .proveit-required label {
diff --git a/proveit.js b/proveit.js
index 7392b14..b3bedbb 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
 */
messages: {
'en': {
-   'proveit-list-tab': 'List',
+   'proveit-list-tab': 'List ($1)',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
@@ -40,7 +40,7 @@
'proveit-no-references': 'No references found'
},
'es': {
-   'proveit-list-tab': 'Lista',
+   'proveit-list-tab': 'Lista ($1)',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
@@ -55,7 +55,7 @@
'proveit-no-references': 'No se han encontrado 
referencias'
},
'fr': {
-   'proveit-list-tab': 'Lister',
+   'proveit-list-tab': 'Lister ($1)',
'proveit-add-tab': 'Ajouter',
'proveit-reference-name-label': 'Nom de la référence',
'proveit-reference-content-label': 'Contenu de la 
référence',
@@ -70,7 +70,7 @@
'proveit-no-references': 'Aucune référence trouvée'
},
'ru': {
-   'proveit-list-tab': 'Список',
+   'proveit-list-tab': 'Список ($1)',
'proveit-add-tab': 'Добавить',
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
@@ -121,10 +121,11 @@
 * Convenience method to get a ProveIt message
 *
 * @param {string} message key without the "proveit-" prefix
+* @param {int} number of references
 * @return {string} message value
 */
-   getMessage: function ( key ) {
-   return mw.message( 'proveit-' + key ).text();
+   getMessage: function ( key, param ) {
+   return mw.message( 'proveit-' + key, param );
},
 
/**
@@ -212,7 +213,7 @@
logo = $( '' ).attr( 'id', 'proveit-logo' ).text( 
'ProveIt' ),
leftBracket = $( '' ).attr( 'id', 
'proveit-left-bracket' ).text( '[' ),
rightBracket = $( '' ).attr( 'id', 
'proveit-right-bracket' ).text( ']' ),
-   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab' ) ),
+   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab', 0 ) ),
addTab = $( '' ).attr( 'id', 'proveit-add-tab' 
).text( proveit.getMessage( 'add-tab' ) ),
content = $( '' ).attr( 'id', 'proveit-content' );
 
@@ -335,9 +336,10 @@
// Add the item to the list
referenceList.append( referenceItem );
}
-
+   $( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', i ) );
$( '#proveit-content' ).html( referenceList );
} else {
+   $( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', 0 ) );
$( '#proveit-content' ).html( $( '' ).attr( 'id', 
'proveit-no-references-message' ).text( proveit.getMessage( 'no-references' ) ) 
);
}
},
@@ -996,6 +998,11 @@
paramNameInput = $( '' ).attr( 'type', 
'hidden' ).addClass( 'proveit-param-name' ).val( paramName );
paramValue

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add reference count

2016-10-17 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add reference count
..

Add reference count

Also an exception for the way quotes are displayed

Change-Id: I5230ef9846035b4ff73a0eeffb148124d7b57ac8
---
M proveit.css
M proveit.js
2 files changed, 16 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/65/316365/1

diff --git a/proveit.css b/proveit.css
index e809606..8d006bf 100755
--- a/proveit.css
+++ b/proveit.css
@@ -60,10 +60,6 @@
padding: 10px;
 }
 
-#proveit-reference-list .proveit-reference-item:nth-child(odd) {
-   background: #f4f4f4;
-}
-
 #proveit-reference-list .proveit-reference-item:nth-child(even) {
background: #fff;
 }
@@ -117,7 +113,7 @@
display: table-cell;
padding: 5px;
vertical-align: top;
-   width: 200px;
+   width: 180px;
 }
 
 #proveit-reference-form .proveit-required label {
diff --git a/proveit.js b/proveit.js
index 7392b14..b3bedbb 100755
--- a/proveit.js
+++ b/proveit.js
@@ -25,7 +25,7 @@
 */
messages: {
'en': {
-   'proveit-list-tab': 'List',
+   'proveit-list-tab': 'List ($1)',
'proveit-add-tab': 'Add',
'proveit-reference-name-label': 'Reference name',
'proveit-reference-content-label': 'Reference content',
@@ -40,7 +40,7 @@
'proveit-no-references': 'No references found'
},
'es': {
-   'proveit-list-tab': 'Lista',
+   'proveit-list-tab': 'Lista ($1)',
'proveit-add-tab': 'Agregar',
'proveit-reference-name-label': 'Nombre de la 
referencia',
'proveit-reference-content-label': 'Contenido de la 
referencia',
@@ -55,7 +55,7 @@
'proveit-no-references': 'No se han encontrado 
referencias'
},
'fr': {
-   'proveit-list-tab': 'Lister',
+   'proveit-list-tab': 'Lister ($1)',
'proveit-add-tab': 'Ajouter',
'proveit-reference-name-label': 'Nom de la référence',
'proveit-reference-content-label': 'Contenu de la 
référence',
@@ -70,7 +70,7 @@
'proveit-no-references': 'Aucune référence trouvée'
},
'ru': {
-   'proveit-list-tab': 'Список',
+   'proveit-list-tab': 'Список ($1)',
'proveit-add-tab': 'Добавить',
'proveit-reference-name-label': 'Имя сноски',
'proveit-reference-content-label': 'Содержание сноски',
@@ -121,10 +121,11 @@
 * Convenience method to get a ProveIt message
 *
 * @param {string} message key without the "proveit-" prefix
+* @param {int} number of references
 * @return {string} message value
 */
-   getMessage: function ( key ) {
-   return mw.message( 'proveit-' + key ).text();
+   getMessage: function ( key, param ) {
+   return mw.message( 'proveit-' + key, param );
},
 
/**
@@ -212,7 +213,7 @@
logo = $( '' ).attr( 'id', 'proveit-logo' ).text( 
'ProveIt' ),
leftBracket = $( '' ).attr( 'id', 
'proveit-left-bracket' ).text( '[' ),
rightBracket = $( '' ).attr( 'id', 
'proveit-right-bracket' ).text( ']' ),
-   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab' ) ),
+   listTab = $( '' ).attr( 'id', 'proveit-list-tab' 
).addClass( 'active' ).text( proveit.getMessage( 'list-tab', 0 ) ),
addTab = $( '' ).attr( 'id', 'proveit-add-tab' 
).text( proveit.getMessage( 'add-tab' ) ),
content = $( '' ).attr( 'id', 'proveit-content' );
 
@@ -335,9 +336,10 @@
// Add the item to the list
referenceList.append( referenceItem );
}
-
+   $( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', i ) );
$( '#proveit-content' ).html( referenceList );
} else {
+   $( '#proveit-list-tab' ).text( proveit.getMessage( 
'list-tab', 0 ) );
$( '#proveit-content' ).html( $( '' ).attr( 'id', 
'proveit-no-references-message' ).text( proveit.getMessage( 'no-references' ) ) 
);
}
},
@@ -996,6 +998,11 @@
paramNameInput = $( '' ).attr( 'type', 
'hidden' ).addClass( 'proveit-param-na

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Reduce spacing between references

2016-10-17 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Reduce spacing between references
..

Reduce spacing between references

To allow more references visible, due to request at the English Wikipedia.

Change-Id: Iecc22cf46b7219296dd41e01f681a91e03eac3b8
---
M proveit.css
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/67/316367/1

diff --git a/proveit.css b/proveit.css
index 8d006bf..bf17f43 100755
--- a/proveit.css
+++ b/proveit.css
@@ -57,7 +57,7 @@
 #proveit-reference-list .proveit-reference-item {
margin: 0;
overflow: hidden;
-   padding: 10px;
+   padding: 5px 10px;
 }
 
 #proveit-reference-list .proveit-reference-item:nth-child(even) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecc22cf46b7219296dd41e01f681a91e03eac3b8
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Reduce spacing between references

2016-10-17 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Reduce spacing between references
..


Reduce spacing between references

To allow more references visible, due to request at the English Wikipedia.

Change-Id: Iecc22cf46b7219296dd41e01f681a91e03eac3b8
---
M proveit.css
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index 8d006bf..bf17f43 100755
--- a/proveit.css
+++ b/proveit.css
@@ -57,7 +57,7 @@
 #proveit-reference-list .proveit-reference-item {
margin: 0;
overflow: hidden;
-   padding: 10px;
+   padding: 5px 10px;
 }
 
 #proveit-reference-list .proveit-reference-item:nth-child(even) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iecc22cf46b7219296dd41e01f681a91e03eac3b8
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikipediaExtracts[master]: Add language validation

2016-10-17 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review.

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

Change subject: Add language validation
..

Add language validation

- Also smarter language guess
- Also link to Wikipedia after every extract

Change-Id: Icaf0a20dc74b1fd179bc5e77d9696e2e6507959d
---
M WikipediaExtracts.php
M i18n/en.json
M i18n/es.json
M i18n/fr.json
M i18n/qqq.json
5 files changed, 28 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikipediaExtracts 
refs/changes/88/316488/1

diff --git a/WikipediaExtracts.php b/WikipediaExtracts.php
index b8db1ce..5696dec 100644
--- a/WikipediaExtracts.php
+++ b/WikipediaExtracts.php
@@ -25,12 +25,23 @@
extract( $args );
if ( $input ) {
if ( filter_var( $input, FILTER_VALIDATE_URL ) ) {
+   // Extract the title
$path = parse_url( $input, PHP_URL_PATH );
$PATH = explode( '/', $path );
$title = $PATH[2];
+
+   // Extract the language
+   $host = parse_url( $input, PHP_URL_HOST );
+   $HOST = explode( '.', $host );
+   $language = $HOST[0];
} else {
$title = $input;
}
+   }
+
+   // Validate language code
+   if ( !is_string( $language ) or strlen( $language ) > 3 ) {
+   return '' . wfMessage( 
'wikipediaextracts-invalid-language', $language ) . '';
}
 
// Query the Wikipedia API
@@ -58,6 +69,8 @@
return '' . wfMessage( 
'wikipediaextracts-404', $title ) . '';
}
$extract = $value->extract;
+   $url = 'https://' . $language . '.wikipedia.org/wiki/' 
. urlencode( $title );
+   $extract .= wfMessage( 'wikipediaextracts-credits', 
$url )->plain();
return $extract;
}
}
@@ -80,14 +93,25 @@
extract( $options );
if ( $input ) {
if ( filter_var( $input, FILTER_VALIDATE_URL ) ) {
+   // Extract the title
$path = parse_url( $input, PHP_URL_PATH );
$PATH = explode( '/', $path );
$title = $PATH[2];
+
+   // Extract the language
+   $host = parse_url( $input, PHP_URL_HOST );
+   $HOST = explode( '.', $host );
+   $language = $HOST[0];
} else {
$title = $input;
}
}
 
+   // Validate language code
+   if ( !is_string( $language ) or strlen( $language ) > 3 ) {
+   return '' . wfMessage( 
'wikipediaextracts-invalid-language', $language ) . '';
+   }
+
// Query the Wikipedia API
$data = array(
'action' => 'query',
diff --git a/i18n/en.json b/i18n/en.json
index 05fc55a..ba72498 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -6,5 +6,6 @@
},
"wikipediaextracts-desc": "Enables to insert content extracted directly 
from Wikipedia.",
"wikipediaextracts-404": "The page '$1' was not found in the English 
Wikipedia",
+   "wikipediaextracts-invalid-language": "The language code '$1' is 
invalid",
"wikipediaextracts-credits": "Extracted from [$1 
Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 24fd951..2dcad0c 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -6,5 +6,6 @@
},
"wikipediaextracts-desc": "Permite insertar contenido extraido 
directamente de Wikipedia.",
"wikipediaextracts-404": "La página '$1' no fue encontrada en la 
Wikipedia en español",
+   "wikipediaextracts-invalid-language": "El código de lenguaje '$1' es 
inválido",
"wikipediaextracts-credits": "Extraído de [$1 Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/fr.json b/i18n/fr.json
index c1f926f..7a09a3a 100644
--- a/i18n/fr.json
+++ b/i18n/fr.json
@@ -7,5 +7,6 @@
},
"wikipediaextracts-desc": "Permet d'insérer du contenu extrait 
directement de Wikipédia Français.",
"wikipediaextracts-404": "La page '$1' n'a pas été trouvée sur 
Wikipédia",
+   "wikipediaextracts-invalid-language": "The language code '$1' is 
invalid",
"wikipediaextracts-credits": "Extrait de [$1 Wikipédia]"
 }
\ No newline at end of file
diff --git a/i18n/qqq.json b/i18n/qqq

[MediaWiki-commits] [Gerrit] mediawiki...WikipediaExtracts[master]: Add language validation

2016-10-18 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged.

Change subject: Add language validation
..


Add language validation

- Also smarter language guess
- Also link to Wikipedia after every extract
- Also fix some encoding issues

Change-Id: Icaf0a20dc74b1fd179bc5e77d9696e2e6507959d
---
M WikipediaExtracts.php
M i18n/en.json
M i18n/es.json
M i18n/fr.json
M i18n/qqq.json
5 files changed, 30 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/WikipediaExtracts.php b/WikipediaExtracts.php
index b8db1ce..cdfa55a 100644
--- a/WikipediaExtracts.php
+++ b/WikipediaExtracts.php
@@ -25,18 +25,29 @@
extract( $args );
if ( $input ) {
if ( filter_var( $input, FILTER_VALIDATE_URL ) ) {
+   // Extract the title
$path = parse_url( $input, PHP_URL_PATH );
$PATH = explode( '/', $path );
$title = $PATH[2];
+
+   // Extract the language
+   $host = parse_url( $input, PHP_URL_HOST );
+   $HOST = explode( '.', $host );
+   $language = $HOST[0];
} else {
$title = $input;
}
}
 
+   // Validate language code
+   if ( !Language::isValidCode( $language ) ) {
+   return '' . wfMessage( 
'wikipediaextracts-invalid-language', $language ) . '';
+   }
+
// Query the Wikipedia API
$data = array(
'action' => 'query',
-   'titles' => $title,
+   'titles' => urldecode( $title ),
'prop' => 'extracts',
'exchars' => $chars,
'exsentences' => $sentences,
@@ -58,6 +69,8 @@
return '' . wfMessage( 
'wikipediaextracts-404', $title ) . '';
}
$extract = $value->extract;
+   $url = 'https://' . $language . '.wikipedia.org/wiki/' 
. urlencode( $title );
+   $extract .= wfMessage( 'wikipediaextracts-credits', 
$url )->parse();
return $extract;
}
}
@@ -80,18 +93,29 @@
extract( $options );
if ( $input ) {
if ( filter_var( $input, FILTER_VALIDATE_URL ) ) {
+   // Extract the title
$path = parse_url( $input, PHP_URL_PATH );
$PATH = explode( '/', $path );
$title = $PATH[2];
+
+   // Extract the language
+   $host = parse_url( $input, PHP_URL_HOST );
+   $HOST = explode( '.', $host );
+   $language = $HOST[0];
} else {
$title = $input;
}
}
 
+   // Validate language code
+   if ( !Language::isValidCode( $language ) ) {
+   return '' . wfMessage( 
'wikipediaextracts-invalid-language', $language ) . '';
+   }
+
// Query the Wikipedia API
$data = array(
'action' => 'query',
-   'titles' => $title,
+   'titles' => urldecode( $title ),
'prop' => 'extracts',
'exchars' => $chars,
'exsentences' => $sentences,
diff --git a/i18n/en.json b/i18n/en.json
index 05fc55a..ba72498 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -6,5 +6,6 @@
},
"wikipediaextracts-desc": "Enables to insert content extracted directly 
from Wikipedia.",
"wikipediaextracts-404": "The page '$1' was not found in the English 
Wikipedia",
+   "wikipediaextracts-invalid-language": "The language code '$1' is 
invalid",
"wikipediaextracts-credits": "Extracted from [$1 
Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 24fd951..2dcad0c 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -6,5 +6,6 @@
},
"wikipediaextracts-desc": "Permite insertar contenido extraido 
directamente de Wikipedia.",
"wikipediaextracts-404": "La página '$1' no fue encontrada en la 
Wikipedia en español",
+   "wikipediaextracts-invalid-language": "El código de lenguaje '$1' es 
inválido",
"wikipediaextracts-credits": "Extraído de [$1 Wikipedia]"
 }
\ No newline at end of file
diff --git a/i18n/fr.json b/i18n/fr.json
index c1f926f..7a

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add Today button on date fields to insert the current date

2017-05-28 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355907 )

Change subject: Add Today button on date fields to insert the current date
..

Add Today button on date fields to insert the current date

Bug: T148233
Change-Id: Id2804594693750895dda6f6324517638fe6c4c79
---
M i18n/en.json
M i18n/es.json
M i18n/qqq.json
M proveit.css
M proveit.js
5 files changed, 37 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/07/355907/1

diff --git a/i18n/en.json b/i18n/en.json
index 0c68e55..2d86961 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -18,5 +18,6 @@
"proveit-no-template": "No template",
"proveit-no-references": "No references found",
"proveit-filter-fields": "Filter fields",
-   "proveit-filter-references": "Filter references"
+   "proveit-filter-references": "Filter references",
+   "proveit-today-button": "Today"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 5c7de16..732a87e 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -19,5 +19,6 @@
"proveit-no-template": "Sin plantilla",
"proveit-no-references": "No se encontraron referencias",
"proveit-filter-fields": "Filtrar campos",
-   "proveit-filter-references": "Filtrar referencias"
+   "proveit-filter-references": "Filtrar referencias",
+   "proveit-today-button": "Hoy"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0c626b6..2314d91 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -21,5 +21,6 @@
"proveit-no-template": "Text for the dropdown option corresponding to 
the references without a template",
"proveit-no-references": "Text for when no references are found",
"proveit-filter-fields": "Placeholder for the input field to filter 
parameters",
-   "proveit-filter-references": "Placeholder for the input field to filter 
references"
+   "proveit-filter-references": "Placeholder for the input field to filter 
references",
+   "proveit-today-button": "Text for the button that inserts the current 
date"
 }
diff --git a/proveit.css b/proveit.css
index 535f071..9b8e338 100755
--- a/proveit.css
+++ b/proveit.css
@@ -108,6 +108,10 @@
width: 100%;
 }
 
+#proveit-reference-form td {
+   position: relative;
+}
+
 #proveit-reference-form td:first-child {
width: 150px;
padding-left: 5px;
@@ -141,6 +145,20 @@
resize: vertical;
 }
 
+#proveit-reference-form button {
+   background: none;
+   border: none;
+   cursor: pointer;
+   font: inherit;
+   padding: .4em;
+   position: absolute;
+   right: 0;
+}
+
+#proveit-reference-form button:hover {
+   text-decoration: underline;
+}
+
 #proveit-footer {
background: #f0f0f0;
border-spacing: 0;
diff --git a/proveit.js b/proveit.js
index 98a63a9..3319fd0 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1051,16 +1051,6 @@
paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
-   // If the parameter is a date, put the current 
date as a placeholder
-   // @todo find a better solution
-   if ( paramData.type === 'date' ) {
-   var date = new Date(),
-    = date.getFullYear(),
-   mm = ( '0' + ( date.getMonth() 
+ 1 ) ).slice( -2 ),
-   dd = ( '0' + date.getDate() 
).slice( -2 );
-   paramPlaceholder =  + '-' + mm + 
'-' + dd;
-   }
-
if ( paramData.description ) {
paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
@@ -1094,6 +1084,19 @@
paramValueColumn = $( '' ).append( 
paramValueInput );
row = $( '' ).addClass( 
'proveit-param-pair' ).append( paramNameColumn, paramValueColumn );
 
+   // If the parameter is a date, add the Today 
button
+   if ( paramData.type === 'date' ) {
+   todayButton = $( '' ).text( 
'Today' ).click( paramValueInput, function ( event ) {
+   var paramValueInput = 
event.data,
+   date = new Date(),
+    = 
date.getFullYear(),
+   mm = ( '0' + ( 
date.getMonth() + 1 ) ).slice( -2 ),
+   dd = ( '0' + 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add Today button on date fields to insert the current date

2017-05-28 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/355907 )

Change subject: Add Today button on date fields to insert the current date
..


Add Today button on date fields to insert the current date

Bug: T148233
Change-Id: Id2804594693750895dda6f6324517638fe6c4c79
---
M i18n/en.json
M i18n/es.json
M i18n/qqq.json
M proveit.css
M proveit.js
5 files changed, 37 insertions(+), 13 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/i18n/en.json b/i18n/en.json
index 0c68e55..2d86961 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -18,5 +18,6 @@
"proveit-no-template": "No template",
"proveit-no-references": "No references found",
"proveit-filter-fields": "Filter fields",
-   "proveit-filter-references": "Filter references"
+   "proveit-filter-references": "Filter references",
+   "proveit-today-button": "Today"
 }
\ No newline at end of file
diff --git a/i18n/es.json b/i18n/es.json
index 5c7de16..732a87e 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -19,5 +19,6 @@
"proveit-no-template": "Sin plantilla",
"proveit-no-references": "No se encontraron referencias",
"proveit-filter-fields": "Filtrar campos",
-   "proveit-filter-references": "Filtrar referencias"
+   "proveit-filter-references": "Filtrar referencias",
+   "proveit-today-button": "Hoy"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0c626b6..2314d91 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -21,5 +21,6 @@
"proveit-no-template": "Text for the dropdown option corresponding to 
the references without a template",
"proveit-no-references": "Text for when no references are found",
"proveit-filter-fields": "Placeholder for the input field to filter 
parameters",
-   "proveit-filter-references": "Placeholder for the input field to filter 
references"
+   "proveit-filter-references": "Placeholder for the input field to filter 
references",
+   "proveit-today-button": "Text for the button that inserts the current 
date"
 }
diff --git a/proveit.css b/proveit.css
index 535f071..9b8e338 100755
--- a/proveit.css
+++ b/proveit.css
@@ -108,6 +108,10 @@
width: 100%;
 }
 
+#proveit-reference-form td {
+   position: relative;
+}
+
 #proveit-reference-form td:first-child {
width: 150px;
padding-left: 5px;
@@ -141,6 +145,20 @@
resize: vertical;
 }
 
+#proveit-reference-form button {
+   background: none;
+   border: none;
+   cursor: pointer;
+   font: inherit;
+   padding: .4em;
+   position: absolute;
+   right: 0;
+}
+
+#proveit-reference-form button:hover {
+   text-decoration: underline;
+}
+
 #proveit-footer {
background: #f0f0f0;
border-spacing: 0;
diff --git a/proveit.js b/proveit.js
index 98a63a9..3319fd0 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1051,16 +1051,6 @@
paramLabel = paramData.label[ 
proveit.contentLanguage ];
}
 
-   // If the parameter is a date, put the current 
date as a placeholder
-   // @todo find a better solution
-   if ( paramData.type === 'date' ) {
-   var date = new Date(),
-    = date.getFullYear(),
-   mm = ( '0' + ( date.getMonth() 
+ 1 ) ).slice( -2 ),
-   dd = ( '0' + date.getDate() 
).slice( -2 );
-   paramPlaceholder =  + '-' + mm + 
'-' + dd;
-   }
-
if ( paramData.description ) {
paramDescription = 
paramData.description[ proveit.contentLanguage ];
}
@@ -1094,6 +1084,19 @@
paramValueColumn = $( '' ).append( 
paramValueInput );
row = $( '' ).addClass( 
'proveit-param-pair' ).append( paramNameColumn, paramValueColumn );
 
+   // If the parameter is a date, add the Today 
button
+   if ( paramData.type === 'date' ) {
+   todayButton = $( '' ).text( 
'Today' ).click( paramValueInput, function ( event ) {
+   var paramValueInput = 
event.data,
+   date = new Date(),
+    = 
date.getFullYear(),
+   mm = ( '0' + ( 
date.getMonth() + 1 ) ).slice( -2 ),
+   dd = ( '0' + 
date.getDate() ).slice( 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Cosmetic changes

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344412 )

Change subject: Cosmetic changes
..

Cosmetic changes

Change-Id: I3c116162a7077461ef356a9007941f99fe6484c5
---
M README.md
M proveit.js
2 files changed, 23 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/12/344412/1

diff --git a/README.md b/README.md
index 2b69537..d615074 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 # ProveIt
 
-ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing Wikipedia articles.
+ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing articles.
 
-Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
+Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index 3830af7..65b8f35 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1,6 +1,6 @@
 /**
- * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing Wikipedia articles.
- * Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
+ * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing articles.
+ * Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
  *
  * Copyright 2008-2011 Georgia Tech Research Corporation, Atlanta, GA 
30332-0415, ALL RIGHTS RESERVED
  * Copyright 2011- Matthew Flaschen
@@ -16,7 +16,7 @@
 var proveit = {
 
/**
-* URL of the ProveIt icons hosted at Commons
+* URLs of the ProveIt icons hosted at Commons
 */
ICON: 
'//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png',
 
@@ -258,10 +258,7 @@
 */
parse: function () {
 
-   // First define the list element
-   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
-
-   // Second, look for all the citations in the wikitext and store 
them in an array for later
+   // First look for all the citations and store them in an array 
for later
var wikitext = proveit.getTextbox().val(),
citations = [],
citationsRegExp = 
/<\s*ref\s+name\s*=\s*["|']?\s*([^"'\s]+)\s*["|']?\s*\/\s*>/ig, // Three 
patterns: ,  and 
@@ -273,10 +270,11 @@
citations.push( citation );
}
 
-   // Third, look for all the references
+   // Then look for all the references
var matches = wikitext.match( 
/<\s*ref[^\/]*>[\s\S]*?<\s*\/\s*ref\s*>/ig ); // We use [\s\S]* instead of .* 
to match newlines
 
if ( matches ) {
+   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
var i, j, reference, referenceItem;
for ( i = 0; i < matches.length; i++ ) {
// Turn all the matches into reference objects
@@ -293,8 +291,7 @@
// Finally, turn all the references into list 
items and insert them into the reference list
referenceItem = reference.toListItem();
 
-   // Add the reference number
-   // We don't use the  numbers because of 
stying reasons
+   // Add the reference number (we don't use the 
 numbers because of stying reasons)
referenceItem.prepend( $( '' ).addClass( 
'proveit-reference-number' ).text( i + 1 ) );
 
// Add the item to the list
@@ -947,12 +944,21 @@
templateRow = $( '' ).append( 
templateLabelColumn, templateSelectColumn );
table.append( templateRow );
 
+   // When the template is changed, reload the table
+   templateSelect.change( this, function ( event ) {
+   console.log( event.data );
+   var reference = event.data;
+   reference.template = $( this ).val();
+   $.cookie( 'proveit-last-template', 
reference.template ); // Remember the user choice
+   table.replaceWith( reference.toTable() );
+   });
+
// Add the parameter fields
var templateData = this.getTemplateData(),
templateMap = this.getTemplateMap(),
paramOrder = this.getParamOrder(),
-   

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Cosmetic changes

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344412 )

Change subject: Cosmetic changes
..


Cosmetic changes

Change-Id: I3c116162a7077461ef356a9007941f99fe6484c5
---
M README.md
M proveit.js
2 files changed, 23 insertions(+), 25 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index 2b69537..d615074 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 # ProveIt
 
-ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing Wikipedia articles.
+ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and delete 
references when editing articles.
 
-Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
+Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
\ No newline at end of file
diff --git a/proveit.js b/proveit.js
index 3830af7..65b8f35 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1,6 +1,6 @@
 /**
- * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing Wikipedia articles.
- * Full documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
+ * ProveIt is a Wikipedia gadget that makes it easy to find, edit, add and 
delete references when editing articles.
+ * Documentation at https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt
  *
  * Copyright 2008-2011 Georgia Tech Research Corporation, Atlanta, GA 
30332-0415, ALL RIGHTS RESERVED
  * Copyright 2011- Matthew Flaschen
@@ -16,7 +16,7 @@
 var proveit = {
 
/**
-* URL of the ProveIt icons hosted at Commons
+* URLs of the ProveIt icons hosted at Commons
 */
ICON: 
'//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png',
 
@@ -258,10 +258,7 @@
 */
parse: function () {
 
-   // First define the list element
-   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
-
-   // Second, look for all the citations in the wikitext and store 
them in an array for later
+   // First look for all the citations and store them in an array 
for later
var wikitext = proveit.getTextbox().val(),
citations = [],
citationsRegExp = 
/<\s*ref\s+name\s*=\s*["|']?\s*([^"'\s]+)\s*["|']?\s*\/\s*>/ig, // Three 
patterns: ,  and 
@@ -273,10 +270,11 @@
citations.push( citation );
}
 
-   // Third, look for all the references
+   // Then look for all the references
var matches = wikitext.match( 
/<\s*ref[^\/]*>[\s\S]*?<\s*\/\s*ref\s*>/ig ); // We use [\s\S]* instead of .* 
to match newlines
 
if ( matches ) {
+   var referenceList = $( '' ).attr( 'id', 
'proveit-reference-list' );
var i, j, reference, referenceItem;
for ( i = 0; i < matches.length; i++ ) {
// Turn all the matches into reference objects
@@ -293,8 +291,7 @@
// Finally, turn all the references into list 
items and insert them into the reference list
referenceItem = reference.toListItem();
 
-   // Add the reference number
-   // We don't use the  numbers because of 
stying reasons
+   // Add the reference number (we don't use the 
 numbers because of stying reasons)
referenceItem.prepend( $( '' ).addClass( 
'proveit-reference-number' ).text( i + 1 ) );
 
// Add the item to the list
@@ -947,12 +944,21 @@
templateRow = $( '' ).append( 
templateLabelColumn, templateSelectColumn );
table.append( templateRow );
 
+   // When the template is changed, reload the table
+   templateSelect.change( this, function ( event ) {
+   console.log( event.data );
+   var reference = event.data;
+   reference.template = $( this ).val();
+   $.cookie( 'proveit-last-template', 
reference.template ); // Remember the user choice
+   table.replaceWith( reference.toTable() );
+   });
+
// Add the parameter fields
var templateData = this.getTemplateData(),
templateMap = this.getTemplateMap(),
paramOrder = this.getParamOrder(),
-   paramPairs = 

[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add support for template redirects

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344421 )

Change subject: Add support for template redirects
..

Add support for template redirects

Now, if "Template:Cite dictionary" redirects to "Template:Cite book",
then both will be available in the dropdown menu.

Change-Id: I6f34bb45cbb4ac7816bf2eb396d10fb5d9e35f61
---
M proveit.js
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/21/344421/1

diff --git a/proveit.js b/proveit.js
index 65b8f35..14fb906 100755
--- a/proveit.js
+++ b/proveit.js
@@ -110,13 +110,21 @@
new mw.Api().get({
'action': 'templatedata',
'titles': templates ? templates.join( '|' ) : 
null,
-   'format': 'json'
+   'format': 'json',
+   'redirects': true
}).done( function ( data ) {
-   //console.log( data );
+   console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
}
+   if ( 'redirects' in data ) {
+   for ( var redirect in data.redirects ) {
+   redirect = data.redirects[ 
redirect ];
+   proveit.templateData[ 
redirect.from ] = proveit.templateData[ redirect.to ];
+   }
+   }
+   console.log( proveit.templateData );
proveit.parse();
});
});

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f34bb45cbb4ac7816bf2eb396d10fb5d9e35f61
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Add support for template redirects

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344421 )

Change subject: Add support for template redirects
..


Add support for template redirects

Now, if "Template:Cite dictionary" redirects to "Template:Cite book",
then both will be available in the dropdown menu.

Change-Id: I6f34bb45cbb4ac7816bf2eb396d10fb5d9e35f61
---
M proveit.js
1 file changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 65b8f35..14fb906 100755
--- a/proveit.js
+++ b/proveit.js
@@ -110,13 +110,21 @@
new mw.Api().get({
'action': 'templatedata',
'titles': templates ? templates.join( '|' ) : 
null,
-   'format': 'json'
+   'format': 'json',
+   'redirects': true
}).done( function ( data ) {
-   //console.log( data );
+   console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
}
+   if ( 'redirects' in data ) {
+   for ( var redirect in data.redirects ) {
+   redirect = data.redirects[ 
redirect ];
+   proveit.templateData[ 
redirect.from ] = proveit.templateData[ redirect.to ];
+   }
+   }
+   console.log( proveit.templateData );
proveit.parse();
});
});

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6f34bb45cbb4ac7816bf2eb396d10fb5d9e35f61
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Mark parameters in the UI according to their status

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/37 )

Change subject: Mark parameters in the UI according to their status
..

Mark parameters in the UI according to their status

- Required parameters are marked with the class "proveit-required"
- Suggested parameters are marked with the class "proveit-suggested"
- Optional parameters are marked with the class "proveit-optional"
- Deprecated parameters are marked with the class "proveit-deprecated"

Bug T150414

Change-Id: Id23a4cd25e65e8bb3122e8d0ecb1e3d39e37fc94
---
M proveit.css
M proveit.js
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/47/37/1

diff --git a/proveit.css b/proveit.css
index a9195cb..8a63e1d 100755
--- a/proveit.css
+++ b/proveit.css
@@ -120,6 +120,10 @@
font-weight: bold;
 }
 
+#proveit-reference-form .proveit-deprecated label {
+   text-decoration: line-through;
+}
+
 #proveit-reference-form input,
 #proveit-reference-form select,
 #proveit-reference-form textarea {
diff --git a/proveit.js b/proveit.js
index 14fb906..282190d 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1026,9 +1026,15 @@
paramValueColumn = $( '' ).append( 
paramValueInput );
row = $( '' ).addClass( 
'proveit-param-pair' ).append( paramNameColumn, paramValueColumn );
 
+   // Mark the parameters according to their status
if ( paramData.required ) {
-   // Mark the required parameters as such 
to style them appropriattely
row.addClass( 'proveit-required' );
+   } else if ( paramData.suggested ) {
+   row.addClass( 'proveit-suggested' );
+   } else if ( paramData.deprecated ) {
+   row.addClass( 'proveit-deprecated' );
+   } else {
+   row.addClass( 'proveit-optional' );
}
 
// Add the row to the table

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id23a4cd25e65e8bb3122e8d0ecb1e3d39e37fc94
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Mark parameters in the UI according to their status

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/37 )

Change subject: Mark parameters in the UI according to their status
..


Mark parameters in the UI according to their status

- Required parameters are marked with the class "proveit-required"
- Suggested parameters are marked with the class "proveit-suggested"
- Optional parameters are marked with the class "proveit-optional"
- Deprecated parameters are marked with the class "proveit-deprecated"

Bug T150414

Change-Id: Id23a4cd25e65e8bb3122e8d0ecb1e3d39e37fc94
---
M proveit.css
M proveit.js
2 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.css b/proveit.css
index a9195cb..8a63e1d 100755
--- a/proveit.css
+++ b/proveit.css
@@ -120,6 +120,10 @@
font-weight: bold;
 }
 
+#proveit-reference-form .proveit-deprecated label {
+   text-decoration: line-through;
+}
+
 #proveit-reference-form input,
 #proveit-reference-form select,
 #proveit-reference-form textarea {
diff --git a/proveit.js b/proveit.js
index 14fb906..282190d 100755
--- a/proveit.js
+++ b/proveit.js
@@ -1026,9 +1026,15 @@
paramValueColumn = $( '' ).append( 
paramValueInput );
row = $( '' ).addClass( 
'proveit-param-pair' ).append( paramNameColumn, paramValueColumn );
 
+   // Mark the parameters according to their status
if ( paramData.required ) {
-   // Mark the required parameters as such 
to style them appropriattely
row.addClass( 'proveit-required' );
+   } else if ( paramData.suggested ) {
+   row.addClass( 'proveit-suggested' );
+   } else if ( paramData.deprecated ) {
+   row.addClass( 'proveit-deprecated' );
+   } else {
+   row.addClass( 'proveit-optional' );
}
 
// Add the row to the table

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id23a4cd25e65e8bb3122e8d0ecb1e3d39e37fc94
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...EducationProgram[master]: Fix red links bug

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344570 )

Change subject: Fix red links bug
..

Fix red links bug

Non-existent articles are now shown as red links.

Bug: T59608
Change-Id: I06792956fcfae16ed59df8de67d051419f32e130
---
M includes/pagers/ArticleTable.php
1 file changed, 2 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram 
refs/changes/70/344570/1

diff --git a/includes/pagers/ArticleTable.php b/includes/pagers/ArticleTable.php
index 03df3cf..37fa32d 100644
--- a/includes/pagers/ArticleTable.php
+++ b/includes/pagers/ArticleTable.php
@@ -375,18 +375,9 @@
 * @return string
 */
protected function getArticleCell( EPArticle $article, $rowSpan ) {
-   $title = Title::newFromID( $article->getPageId() );
-   $hasValidTitle = $title !== null;
-   $titleText = $hasValidTitle ? $title->getFullText() : 
$article->getPageTitle();
+   $title = Title::newFromText( $article->getPageTitle() );
 
-   $html = htmlspecialchars( $titleText );
-
-   if ( $hasValidTitle ) {
-   $html = Linker::link(
-   $title,
-   $html
-   );
-   }
+   $html = Linker::link( $title );
 
$attr = [
'href' => '#',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06792956fcfae16ed59df8de67d051419f32e130
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...EducationProgram[master]: Allow more than one non-existent article per student

2017-03-23 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344572 )

Change subject: Allow more than one non-existent article per student
..

Allow more than one non-existent article per student

Bug T59608

Change-Id: I1abdba3f78d5d7a2c6953a853413dd35d6dad917
---
M .gitignore
M includes/ArticleAdder.php
M includes/ArticleStore.php
3 files changed, 6 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram 
refs/changes/72/344572/1

diff --git a/.gitignore b/.gitignore
index bee951e..1ccdbf1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
+.DS_Store
 .svn
 *~
 *.kate-swp
 .*.swp
 node_modules/
 vendor/
-composer.lock
+composer.lock
\ No newline at end of file
diff --git a/includes/ArticleAdder.php b/includes/ArticleAdder.php
index dbc4cda..373a481 100644
--- a/includes/ArticleAdder.php
+++ b/includes/ArticleAdder.php
@@ -67,7 +67,7 @@
$articleExists = $this->articleStore->hasArticleWith(
$courseId,
$userId,
-   $pageId
+   $pageTitle
);
 
if ( $articleExists ) {
diff --git a/includes/ArticleStore.php b/includes/ArticleStore.php
index ec55c7e..dd99f7d 100644
--- a/includes/ArticleStore.php
+++ b/includes/ArticleStore.php
@@ -258,18 +258,18 @@
 *
 * @param int $courseId
 * @param int $userId
-* @param int $pageId
+* @param int $pageTitle
 *
 * @return boolean
 */
-   public function hasArticleWith( $courseId, $userId, $pageId ) {
+   public function hasArticleWith( $courseId, $userId, $pageTitle ) {
return $this->getReadConnection()->selectRow(
$this->tableName,
[ 'article_id' ],
[
 'article_course_id' => $courseId,
 'article_user_id' => $userId,
-'article_page_id' => $pageId,
+'article_page_title' => $pageTitle,
],
__METHOD__
) !== false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1abdba3f78d5d7a2c6953a853413dd35d6dad917
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikipediaExtracts[master]: Show the credits in the content language

2017-03-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/344640 )

Change subject: Show the credits in the content language
..


Show the credits in the content language

Change-Id: I469156830687699f2142b3c9eb7eb90a0796f068
---
M WikipediaExtracts.php
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/WikipediaExtracts.php b/WikipediaExtracts.php
index bfc36b3..b804169 100644
--- a/WikipediaExtracts.php
+++ b/WikipediaExtracts.php
@@ -191,7 +191,7 @@
'lang' => self::$contentLanguage->getHtmlCode(),
'dir' => self::$contentLanguage->getDir()
],
-   wfMessage( 'wikipediaextracts-credits', $url )->plain()
+   wfMessage( 'wikipediaextracts-credits', $url 
)->inContentLanguage()->plain()
);
}
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I469156830687699f2142b3c9eb7eb90a0796f068
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikipediaExtracts
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
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...WikipediaExtracts[master]: Show the credits in the content language

2017-03-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344640 )

Change subject: Show the credits in the content language
..

Show the credits in the content language

Change-Id: I469156830687699f2142b3c9eb7eb90a0796f068
---
M WikipediaExtracts.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikipediaExtracts 
refs/changes/40/344640/1

diff --git a/WikipediaExtracts.php b/WikipediaExtracts.php
index bfc36b3..b804169 100644
--- a/WikipediaExtracts.php
+++ b/WikipediaExtracts.php
@@ -191,7 +191,7 @@
'lang' => self::$contentLanguage->getHtmlCode(),
'dir' => self::$contentLanguage->getDir()
],
-   wfMessage( 'wikipediaextracts-credits', $url )->plain()
+   wfMessage( 'wikipediaextracts-credits', $url 
)->inContentLanguage()->plain()
);
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I469156830687699f2142b3c9eb7eb90a0796f068
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikipediaExtracts
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Re-add revision tag when previewing

2017-03-29 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345354 )

Change subject: Re-add revision tag when previewing
..

Re-add revision tag when previewing

Bug: T154357
Change-Id: I72a2673442ae30f5fc012cd4cb21c38a46458592
---
M proveit.js
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/54/345354/1

diff --git a/proveit.js b/proveit.js
index 282190d..9d0d4f9 100755
--- a/proveit.js
+++ b/proveit.js
@@ -113,7 +113,7 @@
'format': 'json',
'redirects': true
}).done( function ( data ) {
-   console.log( data );
+   //console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
@@ -124,7 +124,7 @@
proveit.templateData[ 
redirect.from ] = proveit.templateData[ redirect.to ];
}
}
-   console.log( proveit.templateData );
+   //console.log( proveit.templateData );
proveit.parse();
});
});
@@ -170,6 +170,15 @@
mw.hook( 've.activate' ).add( function () {
$( '#proveit' ).remove();
});
+
+   // When previewing, re-add the ProveIt tag (bug T154357)
+   if ( mw.config.get( 'wgAction' ) === 'submit' ) {
+   var currentSummary = $( '#wpSummary' ).val(),
+   proveitSummary = proveit.getOption( 'summary' );
+   if ( currentSummary.indexOf( proveitSummary ) > 
-1 ) {
+   proveit.addTag();
+   }
+   }
},
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72a2673442ae30f5fc012cd4cb21c38a46458592
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Re-add revision tag when previewing

2017-03-29 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/345354 )

Change subject: Re-add revision tag when previewing
..


Re-add revision tag when previewing

Bug: T154357
Change-Id: I72a2673442ae30f5fc012cd4cb21c38a46458592
---
M proveit.js
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 282190d..9d0d4f9 100755
--- a/proveit.js
+++ b/proveit.js
@@ -113,7 +113,7 @@
'format': 'json',
'redirects': true
}).done( function ( data ) {
-   console.log( data );
+   //console.log( data );
for ( var page in data.pages ) {
page = data.pages[ page ];
proveit.templateData[ page.title ] = 
page;
@@ -124,7 +124,7 @@
proveit.templateData[ 
redirect.from ] = proveit.templateData[ redirect.to ];
}
}
-   console.log( proveit.templateData );
+   //console.log( proveit.templateData );
proveit.parse();
});
});
@@ -170,6 +170,15 @@
mw.hook( 've.activate' ).add( function () {
$( '#proveit' ).remove();
});
+
+   // When previewing, re-add the ProveIt tag (bug T154357)
+   if ( mw.config.get( 'wgAction' ) === 'submit' ) {
+   var currentSummary = $( '#wpSummary' ).val(),
+   proveitSummary = proveit.getOption( 'summary' );
+   if ( currentSummary.indexOf( proveitSummary ) > 
-1 ) {
+   proveit.addTag();
+   }
+   }
},
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I72a2673442ae30f5fc012cd4cb21c38a46458592
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Remove unnecessary mw.loader.using call

2017-04-18 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348792 )

Change subject: Remove unnecessary mw.loader.using call
..

Remove unnecessary mw.loader.using call

Bug: T148221
Change-Id: Ie05d069c988ff3c63446973c1c51c4f7b1ae35d2
---
M proveit.js
1 file changed, 11 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/92/348792/1

diff --git a/proveit.js b/proveit.js
index a0abbc2..875e68f 100755
--- a/proveit.js
+++ b/proveit.js
@@ -202,20 +202,18 @@
 
// Make the GUI draggable
var dragged = false;
-   mw.loader.using( 'jquery.ui.draggable' ).then( function () {
-   gui.draggable({
-   handle: header,
-   containment: 'window',
-   start: function ( event ) {
-   if ( event.originalEvent.target.id !== 
'proveit-header' ) {
-   dragged = true;
-   }
-   gui.css({
-   'right': 'auto',
-   'bottom': 'auto'
-   });
+   gui.draggable({
+   handle: header,
+   containment: 'window',
+   start: function ( event ) {
+   if ( event.originalEvent.target.id !== 
'proveit-header' ) {
+   dragged = true;
}
-   });
+   gui.css({
+   'right': 'auto',
+   'bottom': 'auto'
+   });
+   }
});
 
// Lastly, bind events

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie05d069c988ff3c63446973c1c51c4f7b1ae35d2
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Remove unnecessary mw.loader.using call

2017-04-18 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348792 )

Change subject: Remove unnecessary mw.loader.using call
..


Remove unnecessary mw.loader.using call

Bug: T148221
Change-Id: Ie05d069c988ff3c63446973c1c51c4f7b1ae35d2
---
M proveit.js
1 file changed, 11 insertions(+), 13 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index a0abbc2..875e68f 100755
--- a/proveit.js
+++ b/proveit.js
@@ -202,20 +202,18 @@
 
// Make the GUI draggable
var dragged = false;
-   mw.loader.using( 'jquery.ui.draggable' ).then( function () {
-   gui.draggable({
-   handle: header,
-   containment: 'window',
-   start: function ( event ) {
-   if ( event.originalEvent.target.id !== 
'proveit-header' ) {
-   dragged = true;
-   }
-   gui.css({
-   'right': 'auto',
-   'bottom': 'auto'
-   });
+   gui.draggable({
+   handle: header,
+   containment: 'window',
+   start: function ( event ) {
+   if ( event.originalEvent.target.id !== 
'proveit-header' ) {
+   dragged = true;
}
-   });
+   gui.css({
+   'right': 'auto',
+   'bottom': 'auto'
+   });
+   }
});
 
// Lastly, bind events

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie05d069c988ff3c63446973c1c51c4f7b1ae35d2
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix bug when adding citations to references without name

2017-04-18 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348836 )

Change subject: Fix bug when adding citations to references without name
..

Fix bug when adding citations to references without name

Bug: T150101
Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6
---
M proveit.js
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikipedia/gadgets/ProveIt 
refs/changes/36/348836/1

diff --git a/proveit.js b/proveit.js
index 875e68f..ac2c768 100755
--- a/proveit.js
+++ b/proveit.js
@@ -537,9 +537,14 @@
this.cite = function ( event ) {
var reference = event.data;
 
-   // If the reference has no name, ask the user for one
+   if ( reference.name ) {
+   // Add the citation
+   var citation = new proveit.Citation({ 'name': 
reference.name });
+   citation.insert();
+
+   // If there's no reference name, ask the user for one
// @todo check if the name is unique
-   if ( !reference.name ) {
+   } else {
reference.name = prompt( proveit.getMessage( 
'prompt-name' ) );
if ( !reference.name ) {
return;
@@ -551,15 +556,15 @@
reference.loadFromForm();
var newString = reference.string;
 
+   // Add the citation
+   var citation = new proveit.Citation({ 'name': 
reference.name });
+   citation.insert();
+
// Replace the old reference
var textbox = proveit.getTextbox(),
text = textbox.val().replace( 
oldString, newString );
textbox.val( text );
}
-
-   // Add the citation
-   var citation = new proveit.Citation({ 'name': 
reference.name });
-   citation.insert();
};
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Fix bug when adding citations to references without name

2017-04-18 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/348836 )

Change subject: Fix bug when adding citations to references without name
..


Fix bug when adding citations to references without name

Bug: T150101
Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6
---
M proveit.js
1 file changed, 11 insertions(+), 6 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/proveit.js b/proveit.js
index 875e68f..ac2c768 100755
--- a/proveit.js
+++ b/proveit.js
@@ -537,9 +537,14 @@
this.cite = function ( event ) {
var reference = event.data;
 
-   // If the reference has no name, ask the user for one
+   if ( reference.name ) {
+   // Add the citation
+   var citation = new proveit.Citation({ 'name': 
reference.name });
+   citation.insert();
+
+   // If there's no reference name, ask the user for one
// @todo check if the name is unique
-   if ( !reference.name ) {
+   } else {
reference.name = prompt( proveit.getMessage( 
'prompt-name' ) );
if ( !reference.name ) {
return;
@@ -551,15 +556,15 @@
reference.loadFromForm();
var newString = reference.string;
 
+   // Add the citation
+   var citation = new proveit.Citation({ 'name': 
reference.name });
+   citation.insert();
+
// Replace the old reference
var textbox = proveit.getTextbox(),
text = textbox.val().replace( 
oldString, newString );
textbox.val( text );
}
-
-   // Add the citation
-   var citation = new proveit.Citation({ 'name': 
reference.name });
-   citation.insert();
};
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3acc28f611c409d34b06b830bba83fab98d00ab6
Gerrit-PatchSet: 1
Gerrit-Project: wikipedia/gadgets/ProveIt
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add support for nested tags in extensions

2017-04-19 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349016 )

Change subject: Add support for nested tags in extensions
..

Add support for nested tags in extensions

Bug: T3310
Change-Id: I262f9813c58c43c93655f2fb03c1d8155e3ba19f
---
A includes/parser/NestingTest.php
M includes/parser/Preprocessor_DOM.php
2 files changed, 98 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/349016/1

diff --git a/includes/parser/NestingTest.php b/includes/parser/NestingTest.php
new file mode 100644
index 000..c063ce3
--- /dev/null
+++ b/includes/parser/NestingTest.php
@@ -0,0 +1,58 @@
+123", "foo", "123", [] ],
+   [ "foo", "foo", "foo", [] ],
+   [ "AfooB", "foo", "foo", [] ],
+   [ "A123456789B", "foo", 
"123456789", [ "a" => "1", "b" => "foo" ] ],
+   [ "" .
+   "" .
+"" .
+"",
+"ref", "", [ "name" => "citation:1" ]
+   ],
+   [ "", "ref", "", [ "name" => 
"x", "foo" => "foo" ] ]
+   ];
+   }
+
+   function provideNotWorkingCases() {
+   return [
+   [ "123", "foo", null, null ],
+   [ "123456", "foo", "123456", [ 
"foo" => "123" ] ],
+   );
+   }
+
+   var $mInnerText;
+   var $mParams;
+
+   /**
+* @dataProvider provideCases
+*/
+   function testCases( $wikiText, $tag, $expectedInnerText, $expectedParams ) {
+   global $wgParserConf;
+   $parser = new Parser( $wgParserConf );
+
+   $parser->setHook( $tag, [ $this, 'tagCallback' ] );
+   $parserOutput = $parser->parse( $wikiText, Title::newFromText( 'Test' 
), new ParserOptions );
+
+   $this->assertEquals( $expectedInnerText, $this->mInnerText );
+   $this->assertEquals( $expectedParams, $this->mParams );
+
+   $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
+   }
+
+   function tagCallback( $innerText, $params, $parser ) {
+   $this->mInnerText = $innerText;
+   $this->mParams = $params;
+
+   return "dummy";
+   }
+}
\ No newline at end of file
diff --git a/includes/parser/Preprocessor_DOM.php 
b/includes/parser/Preprocessor_DOM.php
index b93c617..1aba80d 100644
--- a/includes/parser/Preprocessor_DOM.php
+++ b/includes/parser/Preprocessor_DOM.php
@@ -478,30 +478,56 @@
$close = '';
} else {
$attrEnd = $tagEndPos;
-   // Find closing tag
-   if (
-   !isset( 
$noMoreClosingTag[$name] ) &&
-   preg_match( "/<\/" . 
preg_quote( $name, '/' ) . "\s*>/i",
-   $text, $matches, 
PREG_OFFSET_CAPTURE, $tagEndPos + 1 )
-   ) {
-   $inner = substr( $text, 
$tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 );
-   $i = $matches[0][1] + strlen( 
$matches[0][0] );
-   $close = '' . 
htmlspecialchars( $matches[0][0] ) . '';
-   } else {
-   // No end tag
+
+   // We know that one start tag was 
already found
+   $numOfStartTags = 1;
+   $numOfEndTags = 0; 
+   $offset = $tagEndPos;
+   $pattern = "/<" . preg_quote( $name, 
'/' ) . "[^>]*>" . "|" . "<\/" . preg_quote( $name, '/' ) . "\s*>/i";
+
+   while ( $numOfStartTags != 
$numOfEndTags ) {
+   // match start tag or end tag 
+   if ( preg_match( $pattern, 
$text, $matches, PREG_OFFSET_CAPTURE, $offset + 1 ) === 0 ) {
+   break; // Nothing found
+   }
+   
+   // what is it, start or end tag?
+   if ( substr( $matches[ 0 ][ 0 
], 0, 2 ) === "...
-   
$noMoreClosingTag[$name] = true;
+   $noMoreClosingTag[ 
$name ] = true;
continue;
}
+   } else {
+   if ( $numOfStartTags === 
$numOfEndTags ) {
+  

[MediaWiki-commits] [Gerrit] mediawiki...LabeledSectionTransclusion[master]: Properly transclude sections within extension tags

2017-04-20 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349223 )

Change subject: Properly transclude sections within extension tags
..

Properly transclude sections within extension tags

Bug: T163411
Change-Id: I303c94b739780849ae4894c999848d9ffcf09f95
---
M LabeledSectionTransclusion.class.php
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LabeledSectionTransclusion
 refs/changes/23/349223/1

diff --git a/LabeledSectionTransclusion.class.php 
b/LabeledSectionTransclusion.class.php
index f4ae2c6..25452c3 100644
--- a/LabeledSectionTransclusion.class.php
+++ b/LabeledSectionTransclusion.class.php
@@ -369,14 +369,16 @@
 
$text = '';
$node = $root->getFirstChild();
+
while ( $node ) {
// If the name of the begin node was specified, find it.
// Otherwise transclude everything from the beginning 
of the page.
if ( $begin != '' ) {
// Find the begin node
$found = false;
-   for ( ; $node; $node = $node->getNextSibling() 
) {
+   while ( $node ) {
if ( $node->getName() != 'ext' ) {
+   $node = $node->getNextSibling();
continue;
}
$parts = $node->splitExt();
@@ -384,8 +386,15 @@
if ( self::isSection( $parts['name'] ) 
) {
if ( preg_match( $beginRegex, 
$parts['attr'] ) ) {
$found = true;
-   break;
+   } else {
+   $found = false;
}
+   break;
+   } else {
+   // If we're inside another 
extension tag (such as  or ), look into the content
+   $dom = 
$parser->preprocessToDom( $parts['inner'] );
+   $node = $dom->getFirstChild();
+   continue;
}
}
if ( !$found || !$node ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I303c94b739780849ae4894c999848d9ffcf09f95
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LabeledSectionTransclusion
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...LabeledSectionTransclusion[master]: Properly transclude sections inside extension tags

2017-04-20 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349256 )

Change subject: Properly transclude sections inside extension tags
..

Properly transclude sections inside extension tags

Bug: T163411
Change-Id: I16dc9e1a63c7dab4f57bc6e6481e15ea037896b5
---
M LabeledSectionTransclusion.class.php
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LabeledSectionTransclusion
 refs/changes/56/349256/1

diff --git a/LabeledSectionTransclusion.class.php 
b/LabeledSectionTransclusion.class.php
index f4ae2c6..08486f7 100644
--- a/LabeledSectionTransclusion.class.php
+++ b/LabeledSectionTransclusion.class.php
@@ -386,6 +386,21 @@
$found = true;
break;
}
+   } else {
+   // If we're inside another 
extension tag (such as  or ), look inside (bug T163411)
+   $dom = 
$parser->preprocessToDom( $parts['inner'] );
+   $child = $dom->getFirstChild();
+   if ( $child->getName() === 
'ext' ) {
+   $childParts = 
$child->splitExt();
+   $childParts = 
array_map( array( $newFrame, 'expand' ), $childParts );
+   if ( self::isSection( 
$childParts['name'] ) ) {
+   if ( 
preg_match( $beginRegex, $childParts['attr'] ) ) {
+   $found 
= true;
+   $node = 
$child;
+   break;
+   }
+   }
+   }
}
}
if ( !$found || !$node ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16dc9e1a63c7dab4f57bc6e6481e15ea037896b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LabeledSectionTransclusion
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] wikipedia...ProveIt[master]: Delete obsolete website files

2017-04-21 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/347212 )

Change subject: Delete obsolete website files
..


Delete obsolete website files

Files are accessible via version control if they are ever needed
(unlikely), so I delete them to keep the repo clean and avoid
confusion for potential new developers.

Bug T148228

Change-Id: I395c9ed037a19e9e6e9038996133e7b3d45a6a58
---
D website/about.php
D website/credits.php
D website/demo.php
D website/developers.php
D website/features.php
D website/footer.php
D website/header.php
D website/img/about_leadIn.jpg
D website/img/citationPopo.jpg
D website/img/credits.jpg
D website/img/credits_image_link.jpg
D website/img/demo_image_link.jpg
D website/img/developers_leadIn.jpg
D website/img/documentation.jpg
D website/img/documentation_image_link.jpg
D website/img/documentation_leadIn.jpg
D website/img/favicon.ico
D website/img/features.jpg
D website/img/features_image_link.jpg
D website/img/features_leadIn.jpg
D website/img/gCode.jpg
D website/img/gCode_image_link.jpg
D website/img/gCode_leadIn.jpg
D website/img/get.jpg
D website/img/get_rollover.jpg
D website/img/index.jpg
D website/img/install.jpg
D website/img/notfound.jpg
D website/img/proveIt_logo-02.jpg
D website/img/proveIt_logo_small-04.png
D website/img/proveIt_logo_small.jpg
D website/img/proveit_logo-02.png
D website/img/proveit_logo.png
D website/img/proveit_logo_small.png
D website/img/reportabug.jpg
D website/img/reportabug_image_link.jpg
D website/img/reportabug_leadIn.jpg
D website/img/research.jpg
D website/img/research_image_link.jpg
D website/img/research_leadIn.jpg
D website/img/screenshots.jpg
D website/img/screenshots/proveit-add.png
D website/img/screenshots/proveit-basic.png
D website/img/screenshots/proveit-edit.png
D website/img/screenshots/proveit-minimized.png
D website/img/screenshots_image_link.jpg
D website/img/screenshots_leadIn.jpg
D website/img/tempLogo.jpg
D website/img/test_link.jpg
D website/img/theTeam_leadIn.jpg
D website/img/theteam.jpg
D website/img/theteam_image_link.jpg
D website/img/tutorials.jpg
D website/img/tutorials_image_link.jpg
D website/img/tutorials_leadIn.jpg
D website/img/userguide.jpg
D website/img/userguide_image_link.jpg
D website/img/users_leadIn.jpg
D website/img/wiki.jpg
D website/img/wiki_image_link.jpg
D website/img/wiki_leadIn.jpg
D website/img/wikipedia_referencing_simplified.jpg
D website/index.php
D website/install.php
D website/jquery.ba-hashchange.min.js
D website/notfound.php
D website/pdf/a43-luther.pdf
D website/reportabug.php
D website/research.php
D website/screenshots.php
D website/scripts.js
D website/theteam.php
D website/tutorials.php
D website/userguide.php
D website/users.php
D website/website_styles.css
D website/wikibits.js
D website_configuration/proveit
78 files changed, 0 insertions(+), 1,866 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved



diff --git a/website/about.php b/website/about.php
deleted file mode 100644
index f883a77..000
--- a/website/about.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
-   
-   Research 
 
-   The Team
-   Credits
-   
-   
-
-
-
\ No newline at end of file
diff --git a/website/credits.php b/website/credits.php
deleted file mode 100644
index 9b9e642..000
--- a/website/credits.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-   
-
-   
-   
-   
-
-   
-   Credits
-   
-
-
-   Besides core team members, ProveIt depends on the efforts of issue reporters and others providing feedback.  It 
also relies on the following code and resources:
-
-   
-   MediaWiki, 
including http://bits.wikimedia.org/skins-1.5/common/wikibits.js";>wikibits.js.
-   Wikipedia 
http://bits.wikimedia.org/skins-1.5/common/jquery.min.js";>version 
of http://jquery.com/";>jQuery, which must already be loaded.
-   Icons from 
the http://www.famfamfam.com/lab/icons/silk/";>Silk icon set, by 
Mark James, used under Creative Commons Attribution 3.0 License. 
-   http://jqueryui.com";>jQueryUI, via MediaWiki core.
-   Public 
domain code from QuirksMode, by Peter

[MediaWiki-commits] [Gerrit] mediawiki...Poncho[master]: Update to latest MediaWiki

2017-04-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349964 )

Change subject: Update to latest MediaWiki
..

Update to latest MediaWiki

Also several minor improvements and fixes

Change-Id: Iaeb268fa878db9ce5c133c6249667b30af5ac5d2
---
M Poncho.css
M Poncho.js
M Poncho.php
M Poncho.phtml
D README.md
M i18n/en.json
M i18n/es.json
A i18n/qqq.json
M skin.json
9 files changed, 100 insertions(+), 136 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Poncho 
refs/changes/64/349964/1

diff --git a/Poncho.css b/Poncho.css
index 6d73166..888a56d 100644
--- a/Poncho.css
+++ b/Poncho.css
@@ -1,3 +1,6 @@
+/**
+ * Site-wide elements
+ */
 body {
font-family: Arial;
font-size: 14px;
@@ -5,61 +8,50 @@
margin: 0;
padding: 0;
 }
-
 a {
color: blue;
text-decoration: none;
 }
-
 a:hover {
text-decoration: underline;
 }
-
 h2 {
margin: 1em 0 0.5em 0;
 }
-
 img {
max-width: 100%;
height: auto;
 }
-
 pre {
white-space: pre-wrap;
 }
-
 fieldset {
border: 1px solid #aaa;
margin: 1em 0;
 }
 
+/**
+ * Specific elements
+ */
 #mw-js-message {
display: none;
 }
-
 .mw-indicator {
float: right;
 }
 
-/* Main */
-
-#main {
-   margin-left: 10em;
-}
-
-/* Sidebar */
-
+/**
+ * Header and main menu
+ */
 #header-wrapper {
background: #f9f9f9;
border-bottom: 1px solid #aaa;
 }
-
 #header {
margin: auto;
max-width: 1000px;
padding: 0 1em;
 }
-
 #logo {
background-size: contain;
display: inline-block;
@@ -68,30 +60,25 @@
width: 32px;
height: 32px;
 }
-
 #menu {
display: inline;
list-style: none;
margin: 0;
padding: 0;
 }
-
 #menu li {
display: inline;
position: relative;
 }
-
 #menu span {
display: inline-block;
padding: 15px 10px;
text-decoration: none;
 }
-
 #menu li:hover span {
background: #aaa;
cursor: default;
 }
-
 #menu .submenu {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -104,11 +91,9 @@
word-spacing: nowrap;
z-index: 1;
 }
-
 #menu .submenu li {
display: block;
 }
-
 #menu .submenu a {
color: inherit;
cursor: pointer;
@@ -119,14 +104,14 @@
width: 100%;
 }
 
-/* Search form */
-
+/**
+ * Search form
+ */
 #search-form {
float: right;
padding: 7px 0;
position: relative;
 }
-
 #search-form button {
background: url( 'images/lens.png' );
background-size: contain;
@@ -138,12 +123,10 @@
width: 32px;
height: 32px;
 }
-
 #search-form button.active {
background-color: white;
border-color: #aaa;
 }
-
 #search-form input {
border: 1px solid #aaa;
border-right: none;
@@ -157,43 +140,19 @@
z-index: 1;
 }
 
-/* Actions */
-
-#actions {
-   display: block;
-   font-size: small;
-   font-weight: normal;
-   list-style: none;
-   margin: 50px 0;
-   padding: 0;
-}
-
-#actions li {
-   display: inline;
-   margin: 0 5px;
-   padding: 0;
-}
-
-#actions a {
-   text-decoration: none;
-}
-
-#actions a:hover {
-   text-decoration: underline;
-}
-
-/* Title */
-
+/**
+ * Title
+ */
 #title {
 
 }
-
 #subtitle {
margin: 1em 0;
 }
 
-/* Content */
-
+/**
+ * Content
+ */
 #content {
line-height: 1.5;
margin: 0 auto;
@@ -201,24 +160,23 @@
overflow: hidden;
padding: 1em;
 }
-
 #mw-content-text ol {
margin: 0 0 0 20px;
padding: 0;
 }
-
 #mw-content-text ul {
margin: 0 0 0 20px;
padding: 0;
 }
-
 #mw-content-text pre {
background: #f9f9f9;
border: 1px solid #aaa;
padding: 20px;
 }
 
-/* Table of contents */
+/**
+ * Table of contents
+ */
 #mw-content-text #toc {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -242,7 +200,9 @@
padding: 1em;
 }
 
-/* Thumbs */
+/**
+ * Thumbnails
+ */
 .thumb {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -274,7 +234,9 @@
margin: 0;
 }
 
-/* Edit section button */
+/**
+ * Edit section button
+ */
 .mw-editsection {
font-size: small;
font-weight: normal;
@@ -284,8 +246,9 @@
display: none;
 }
 
-/* Edit page */
-
+/**
+ * Edit page
+ */
 #wpTextbox1 {
box-sizing: border-box;
width: 100%;
@@ -308,8 +271,9 @@
display: none;
 }
 
-/* Categories */
-
+/**
+ * Categories
+ */
 #catlinks {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -317,38 +281,29 @@
margin: 50px 0;
padding: 1em;
 }
-
 #catlinks ul {
margin: 0;
 }
 
-/* Footer */
-
-#facebook-image {
-   display: none;
-}
-
-#footer-wrapper {
-   background: black;  
-}
-
+/**
+ * Footer
+ */
 #footer {
+   border-top: 1px sol

[MediaWiki-commits] [Gerrit] mediawiki...Poncho[master]: Update to latest MediaWiki

2017-04-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/349964 )

Change subject: Update to latest MediaWiki
..


Update to latest MediaWiki

Also several minor improvements and fixes

Change-Id: Iaeb268fa878db9ce5c133c6249667b30af5ac5d2
---
M Poncho.css
M Poncho.js
M Poncho.php
M Poncho.phtml
D README.md
M i18n/en.json
M i18n/es.json
A i18n/qqq.json
M skin.json
9 files changed, 100 insertions(+), 136 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/Poncho.css b/Poncho.css
index 6d73166..888a56d 100644
--- a/Poncho.css
+++ b/Poncho.css
@@ -1,3 +1,6 @@
+/**
+ * Site-wide elements
+ */
 body {
font-family: Arial;
font-size: 14px;
@@ -5,61 +8,50 @@
margin: 0;
padding: 0;
 }
-
 a {
color: blue;
text-decoration: none;
 }
-
 a:hover {
text-decoration: underline;
 }
-
 h2 {
margin: 1em 0 0.5em 0;
 }
-
 img {
max-width: 100%;
height: auto;
 }
-
 pre {
white-space: pre-wrap;
 }
-
 fieldset {
border: 1px solid #aaa;
margin: 1em 0;
 }
 
+/**
+ * Specific elements
+ */
 #mw-js-message {
display: none;
 }
-
 .mw-indicator {
float: right;
 }
 
-/* Main */
-
-#main {
-   margin-left: 10em;
-}
-
-/* Sidebar */
-
+/**
+ * Header and main menu
+ */
 #header-wrapper {
background: #f9f9f9;
border-bottom: 1px solid #aaa;
 }
-
 #header {
margin: auto;
max-width: 1000px;
padding: 0 1em;
 }
-
 #logo {
background-size: contain;
display: inline-block;
@@ -68,30 +60,25 @@
width: 32px;
height: 32px;
 }
-
 #menu {
display: inline;
list-style: none;
margin: 0;
padding: 0;
 }
-
 #menu li {
display: inline;
position: relative;
 }
-
 #menu span {
display: inline-block;
padding: 15px 10px;
text-decoration: none;
 }
-
 #menu li:hover span {
background: #aaa;
cursor: default;
 }
-
 #menu .submenu {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -104,11 +91,9 @@
word-spacing: nowrap;
z-index: 1;
 }
-
 #menu .submenu li {
display: block;
 }
-
 #menu .submenu a {
color: inherit;
cursor: pointer;
@@ -119,14 +104,14 @@
width: 100%;
 }
 
-/* Search form */
-
+/**
+ * Search form
+ */
 #search-form {
float: right;
padding: 7px 0;
position: relative;
 }
-
 #search-form button {
background: url( 'images/lens.png' );
background-size: contain;
@@ -138,12 +123,10 @@
width: 32px;
height: 32px;
 }
-
 #search-form button.active {
background-color: white;
border-color: #aaa;
 }
-
 #search-form input {
border: 1px solid #aaa;
border-right: none;
@@ -157,43 +140,19 @@
z-index: 1;
 }
 
-/* Actions */
-
-#actions {
-   display: block;
-   font-size: small;
-   font-weight: normal;
-   list-style: none;
-   margin: 50px 0;
-   padding: 0;
-}
-
-#actions li {
-   display: inline;
-   margin: 0 5px;
-   padding: 0;
-}
-
-#actions a {
-   text-decoration: none;
-}
-
-#actions a:hover {
-   text-decoration: underline;
-}
-
-/* Title */
-
+/**
+ * Title
+ */
 #title {
 
 }
-
 #subtitle {
margin: 1em 0;
 }
 
-/* Content */
-
+/**
+ * Content
+ */
 #content {
line-height: 1.5;
margin: 0 auto;
@@ -201,24 +160,23 @@
overflow: hidden;
padding: 1em;
 }
-
 #mw-content-text ol {
margin: 0 0 0 20px;
padding: 0;
 }
-
 #mw-content-text ul {
margin: 0 0 0 20px;
padding: 0;
 }
-
 #mw-content-text pre {
background: #f9f9f9;
border: 1px solid #aaa;
padding: 20px;
 }
 
-/* Table of contents */
+/**
+ * Table of contents
+ */
 #mw-content-text #toc {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -242,7 +200,9 @@
padding: 1em;
 }
 
-/* Thumbs */
+/**
+ * Thumbnails
+ */
 .thumb {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -274,7 +234,9 @@
margin: 0;
 }
 
-/* Edit section button */
+/**
+ * Edit section button
+ */
 .mw-editsection {
font-size: small;
font-weight: normal;
@@ -284,8 +246,9 @@
display: none;
 }
 
-/* Edit page */
-
+/**
+ * Edit page
+ */
 #wpTextbox1 {
box-sizing: border-box;
width: 100%;
@@ -308,8 +271,9 @@
display: none;
 }
 
-/* Categories */
-
+/**
+ * Categories
+ */
 #catlinks {
background: #f9f9f9;
border: 1px solid #aaa;
@@ -317,38 +281,29 @@
margin: 50px 0;
padding: 1em;
 }
-
 #catlinks ul {
margin: 0;
 }
 
-/* Footer */
-
-#facebook-image {
-   display: none;
-}
-
-#footer-wrapper {
-   background: black;  
-}
-
+/**
+ * Footer
+ */
 #footer {
+   border-top: 1px so

[MediaWiki-commits] [Gerrit] mediawiki...Poncho[master]: Update messages

2017-04-24 Thread Sophivorus (Code Review)
Sophivorus has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349972 )

Change subject: Update messages
..

Update messages

Change-Id: Id16b1fad18f821427e98d9dcce07e32635f3cdf1
---
M i18n/en.json
M i18n/es.json
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Poncho 
refs/changes/72/349972/1

diff --git a/i18n/en.json b/i18n/en.json
index 939d216..34e2f50 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,7 +4,7 @@
"Sophivorus"
]
},
-   "poncho-desc": "Responsive skin, compatible with mobile devices.",
+   "poncho-desc": "Simple, clean, responsive, mobile-friendly skin.",
"poncho-wiki": "Wiki",
"poncho-tools": "Tools",
"poncho-actions": "Actions",
diff --git a/i18n/es.json b/i18n/es.json
index 283707a..7fd8b2b 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -4,7 +4,7 @@
"Sophivorus"
]
},
-   "poncho-desc": "Skin adaptable, compatible con dispositivos móbiles.",
+   "poncho-desc": "Skin simple, limpia, adaptable y amigable con 
dispositivos móbiles.",
"poncho-wiki": "Wiki",
"poncho-tools": "Herramientas",
"poncho-actions": "Acciones",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id16b1fad18f821427e98d9dcce07e32635f3cdf1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Poncho
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 

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


[MediaWiki-commits] [Gerrit] mediawiki...Poncho[master]: Update messages

2017-04-24 Thread Sophivorus (Code Review)
Sophivorus has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/349972 )

Change subject: Update messages
..


Update messages

Change-Id: Id16b1fad18f821427e98d9dcce07e32635f3cdf1
---
M i18n/en.json
M i18n/es.json
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Sophivorus: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/i18n/en.json b/i18n/en.json
index 939d216..34e2f50 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,7 +4,7 @@
"Sophivorus"
]
},
-   "poncho-desc": "Responsive skin, compatible with mobile devices.",
+   "poncho-desc": "Simple, clean, responsive, mobile-friendly skin.",
"poncho-wiki": "Wiki",
"poncho-tools": "Tools",
"poncho-actions": "Actions",
diff --git a/i18n/es.json b/i18n/es.json
index 283707a..7fd8b2b 100644
--- a/i18n/es.json
+++ b/i18n/es.json
@@ -4,7 +4,7 @@
"Sophivorus"
]
},
-   "poncho-desc": "Skin adaptable, compatible con dispositivos móbiles.",
+   "poncho-desc": "Skin simple, limpia, adaptable y amigable con 
dispositivos móbiles.",
"poncho-wiki": "Wiki",
"poncho-tools": "Herramientas",
"poncho-actions": "Acciones",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id16b1fad18f821427e98d9dcce07e32635f3cdf1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Poncho
Gerrit-Branch: master
Gerrit-Owner: Sophivorus 
Gerrit-Reviewer: Sophivorus 
Gerrit-Reviewer: jenkins-bot <>

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


  1   2   >