Euvl has uploaded a new change for review.

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


Change subject: improvements for 8e9bd87ede91cc5e07bcf79480bb31b34522ff67 commit
......................................................................

improvements for 8e9bd87ede91cc5e07bcf79480bb31b34522ff67 commit

Change-Id: I1b73c35d91e8a7f7a7412e75d219bf71d985326a
---
M Lingo.php
M LingoBasicBackend.php
M LingoElement.php
M LingoHooks.php
4 files changed, 38 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Lingo 
refs/changes/07/70807/1

diff --git a/Lingo.php b/Lingo.php
index 605a8aa..4e29ab4 100644
--- a/Lingo.php
+++ b/Lingo.php
@@ -81,7 +81,7 @@
 
 $wgHooks['ArticlePurge'][] = 'LingoBasicBackend::purgeCache';
 $wgHooks['ArticleSave'][] = 'LingoBasicBackend::purgeCache';
-$wgHooks['ParserFirstCallInit'][] = 'LingoBasicBackend::registerTags';
+$wgHooks['ParserFirstCallInit'][] = 'LingoHooks::registerTags';
 
 // register resource modules with the Resource Loader
 $wgResourceModules['ext.Lingo.Styles'] = array(
diff --git a/LingoBasicBackend.php b/LingoBasicBackend.php
index cab7084..6635464 100644
--- a/LingoBasicBackend.php
+++ b/LingoBasicBackend.php
@@ -84,17 +84,17 @@
 
                        $chunks = explode( ':', $entry[1], 2 );
 
-            // found a new definition?
-            if ( count ( $chunks ) == 2 ) {
-                // if definitions and term are already set, and now goes 
definition again,
-                // it means that we work with a totally new term and have to 
remove previous data
-                // from static variables
-                if ($definitions && $term) {
-                    $definitions = [];
-                    $term = null;
-                }
-                $definitions[] = trim( $chunks[1] );
-            }
+                       // found a new definition?
+                       if ( count ( $chunks ) == 2 ) {
+                               // if definitions and term are already set, and 
now goes definition again,
+                               // it means that we work with a totally new 
term and have to remove previous data
+                               // from static variables
+                               if ($definitions && $term) {
+                                       $definitions = [];
+                                       $term = null;
+                               }
+                               $definitions[] = trim( $chunks[1] );
+                       }
 
                        // found a new term?
                        if (count( $chunks ) >= 1 && strlen( $chunks[0] ) >= 1 
) {
@@ -146,26 +146,5 @@
        public function useCache() {
                return true;
        }
-
-    /**
-     * Creates tag hook(s)
-     */
-    public static function registerTags(Parser $parser) {
-        $parser->setHook( 'noglossary',  
'LingoBasicBackend::noglossaryTagRenderer');
-        return true;
-    }
-
-    /**
-     * Sets hook on 'noglossary' tag
-     * @static
-     * @param $input
-     * @param array $args
-     * @param Parser $parser
-     * @param PPFrame $frame
-     * @return string
-     */
-    public static function noglossaryTagRenderer( $input, array $args, Parser 
$parser, PPFrame $frame ) {
-        return '<span class="noglossary">'.$input.'</span>';
-    }
 }
 
diff --git a/LingoElement.php b/LingoElement.php
index e1d1b36..30d1cc9 100644
--- a/LingoElement.php
+++ b/LingoElement.php
@@ -125,11 +125,11 @@
 
                                foreach ( $this->mDefinitions as $definition ) {
                                        wfSuppressWarnings();
-                    $definitions = null;
-                    foreach ($definition[self::ELEMENT_DEFINITIONS] as $def) {
-                        $definitions .= $def . ', ';
-                    }
-                                       $element = $doc->createElement( 'span', 
htmlentities(trim($definitions, ', '), ENT_COMPAT, 'UTF-8' ) );
+                                       $definitions = null;
+                                       foreach ( 
$definition[self::ELEMENT_DEFINITIONS] as $def ) {
+                                               $definitions .= $def . ', ';
+                                       }
+                                       $element = $doc->createElement( 'span', 
htmlentities( trim($definitions, ', ' ), ENT_COMPAT, 'UTF-8' ) );
                                        wfRestoreWarnings();
                                        if ( $definition[self::ELEMENT_LINK] ) {
                                                $linkedTitle = 
Title::newFromText( $definition[self::ELEMENT_LINK] );
diff --git a/LingoHooks.php b/LingoHooks.php
index 464c5a5..413d005 100644
--- a/LingoHooks.php
+++ b/LingoHooks.php
@@ -66,5 +66,26 @@
                return true;
        }
 
+       /**
+        * Creates tag hook(s)
+        */
+       public static function registerTags(Parser $parser) {
+               $parser->setHook( 'noglossary',  
'LingoHooks::noglossaryTagRenderer');
+               return true;
+       }
+
+       /**
+        * Sets hook on 'noglossary' tag
+        * @static
+        * @param $input
+        * @param array $args
+        * @param Parser $parser
+        * @param PPFrame $frame
+        * @return string
+        */
+       public static function noglossaryTagRenderer( $input, array $args, 
Parser $parser, PPFrame $frame ) {
+               $output = $parser->recursiveTagParse( $input, $frame );
+               return '<span class="noglossary">'.$output.'</span>';
+       }
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b73c35d91e8a7f7a7412e75d219bf71d985326a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Lingo
Gerrit-Branch: master
Gerrit-Owner: Euvl <eu.vlase...@gmail.com>

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

Reply via email to