* (bug 2374) Allow extension tags to be terminated empty elements
[lhc/web/wiklou.git] / includes / Parser.php
index 0824335..a910afe 100644 (file)
@@ -272,6 +272,9 @@ class Parser
                        $params = array( );
                }
 
+               // Hack to support short XML style tags
+               $text = preg_replace( "/<$tag(\\s+[^>]*|\\s*)\\/>/i", "<$tag\\1></$tag>", $text );
+               
                if( $tag == STRIP_COMMENTS ) {
                        $start = '/<!--()/';
                        $end   = '/-->/';
@@ -3102,9 +3105,10 @@ class Parser
         */
        function renderImageGallery( $text ) {
                # Setup the parser
-               global $wgUser, $wgParser, $wgTitle;
+               global $wgUser, $wgTitle;
                $parserOptions = ParserOptions::newFromUser( $wgUser );
-       
+               $localParser = new Parser();
+               
                global $wgLinkCache;
                $ig = new ImageGallery();
                $ig->setShowBytes( false );
@@ -3130,7 +3134,7 @@ class Parser
                                $label = '';
                        }
                        
-                       $html = $wgParser->parse( $label , $wgTitle, $parserOptions );
+                       $html = $localParser->parse( $label , $wgTitle, $parserOptions );
                        $html = $html->mText;
                        
                        $ig->add( new Image( $nt ), $html );