Ticket #2223: 2223_2.patch

File 2223_2.patch, 4.0 KB (added by arczi, 19 months ago)
  • FCKeditorParser.body.php

     
    306306        } 
    307307 
    308308        function replaceInternalLinks( $text ) { 
     309                $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[RTENOTITLE$1|$1]]", $text);   //#2223: [[()]] =>      [[RTENOTITLE%1|%1]] 
    309310                $text = preg_replace("/\[\[:(.*?)\]\]/", "[[RTECOLON$1]]", $text);      //change ':' => 'RTECOLON' in links 
    310                 return parent::replaceInternalLinks($text); 
     311                $text = parent::replaceInternalLinks($text); 
     312                $text = preg_replace("/\[\[RTENOTITLE(.*?)\|/", "[[", $text);                           // remove unused RTENOTITLE 
     313 
     314                return $text; 
    311315        } 
    312316 
    313317        function makeImage( $nt, $options ) { 
  • mw12/FCKeditorParser_OldPP.body.php

     
    307307        } 
    308308 
    309309        function replaceInternalLinks( $text ) { 
     310                $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "[[RTENOTITLE$1|$1]]", $text);   //#2223: [[()]] =>      [[RTENOTITLE%1|%1]] 
    310311                $text = preg_replace("/\[\[:(.*?)\]\]/", "[[RTECOLON$1]]", $text);      //change ':' => 'RTECOLON' in links 
    311                 return parent::replaceInternalLinks($text); 
     312                $text = parent::replaceInternalLinks($text); 
     313                $text = preg_replace("/\[\[RTENOTITLE(.*?)\|/", "[[", $text);                           // remove unused RTENOTITLE 
     314 
     315                return $text; 
    312316        } 
    313317 
    314318        function makeImage( $nt, $options ) { 
  • plugins/mediawiki/dialogs/link.html

     
    6969        if ( sHRef == null ) 
    7070                sHRef = oLink.getAttribute( 'href' , 2 ) || '' ; 
    7171                 
     72        if (sHRef.toLowerCase().StartsWith( 'rtenotitle' ) ) 
     73        { 
     74                sHRef = sHRef.substring(10); 
     75                bLinkEqualsName = true; 
     76        } 
     77                 
    7278        if ( sHRef == oLink.innerHTML ) 
    7379                bLinkEqualsName = true ; 
    7480 
     
    180186function Ok() 
    181187{ 
    182188        var sUri = GetE('txtUrl').value ; 
     189        var realUri = sUri; 
     190        if ( bLinkEqualsName ) { 
     191                sUri = 'RTENOTITLE'+ sUri; 
     192        } 
    183193        if (sUri.StartsWith( ':' ) ) 
    184194                sUri = sUri.replace(/:/, "rtecolon"); 
    185195        var sInnerHtml ; 
     
    215225                SetAttribute( oLink, '_fcksavedurl', sUri ) ; 
    216226 
    217227                if ( bLinkEqualsName ) 
    218                         oLink.innerHTML = sUri ; 
     228                        oLink.innerHTML = realUri ; 
    219229                else 
    220230                        oLink.innerHTML = sInnerHtml ;          // Set (or restore) the innerHTML 
    221231 
  • plugins/mediawiki/fckplugin.js

     
    344344 
    345345                                                case 'a' : 
    346346 
     347                                                        var pipeline = true; 
    347348                                                        // Get the actual Link href. 
    348349                                                        var href = htmlNode.getAttribute( '_fcksavedurl' ) ; 
    349350                                                        var hrefType            = htmlNode.getAttribute( '_fck_mw_type' ) || '' ; 
     
    365366                                                                var isWikiUrl = !( href.StartsWith( 'mailto:' ) || /^\w+:\/\//.test( href ) ) ; 
    366367                                                                stringBuilder.push( isWikiUrl ? '[[' : '[' ) ; 
    367368                                                        } 
     369                                                        //#2223 
     370                                                        if (href.toLowerCase().StartsWith( 'rtenotitle' )) 
     371                                                        { 
     372                                                                href = href.substring(10); 
     373                                                                if ( htmlNode.innerHTML == href ) pipeline = false; 
     374                                                        } 
    368375                                                        if (href.toLowerCase().StartsWith( 'rtecolon' ))                //change 'rtecolon=' => ':' in links 
    369376                                                        { 
    370377                                                                stringBuilder.push(':'); 
    371378                                                                href = href.substring(8); 
    372379                                                        } 
    373380                                                        stringBuilder.push( href ) ; 
    374                                                         if ( htmlNode.innerHTML != '[n]' && (!isWikiUrl || href != htmlNode.innerHTML || !href.toLowerCase().StartsWith("category:"))) 
     381                                                        if ( pipeline && htmlNode.innerHTML != '[n]' && (!isWikiUrl || href != htmlNode.innerHTML || !href.toLowerCase().StartsWith("category:"))) 
    375382                                                        { 
    376383                                                                stringBuilder.push( isWikiUrl? '|' : ' ' ) ; 
    377384                                                                this._AppendChildNodes( htmlNode, stringBuilder, prefix ) ;