removed a debug output when setting up the dropbox for language variants
[lhc/web/wiklou.git] / includes / Parser.php
index 3482001..30eb6b5 100644 (file)
@@ -20,7 +20,7 @@
  *
  * settings:
  *  $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*,
- *  $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*,
+ *  $wgNamespacesWithSubpages, $wgAllowExternalImages*,
  *  $wgLocaltimezone
  *
  *  * only within ParserOptions
@@ -240,8 +240,8 @@ class Parser
                #$text = str_replace( $uniq_prefix, wfHtmlEscapeFirst( $uniq_prefix ), $text );
 
                # html
-               global $wgRawHtml;
-               if( $wgRawHtml ) {
+               global $wgRawHtml, $wgWhitelistEdit;
+               if( $wgRawHtml && $wgWhitelistEdit ) {
                        $text = Parser::extractTags('html', $text, $html_content, $uniq_prefix);
                        foreach( $html_content as $marker => $content ) {
                                if ($render ) {
@@ -570,21 +570,17 @@ class Parser
                return $t ;
        }
 
-       # Parses the text and adds the result to the strip state
-       # Returns the strip tag
-       function stripParse( $text, $newline, $args ) {
-               $text = $this->strip( $text, $this->mStripState );
-               $text = $this->internalParse( $text, (bool)$newline, $args, false );
-               return $newline.$this->insertStripItem( $text, $this->mStripState );
-       }
-
        function internalParse( $text, $linestart, $args = array(), $isMain=true ) {
+        global $wgLang;
+
                $fname = 'Parser::internalParse';
                wfProfileIn( $fname );
 
                $text = $this->removeHTMLtags( $text );
                $text = $this->replaceVariables( $text, $args );
 
+               $text = $wgLang->convert($text);
+
                $text = preg_replace( '/(^|\n)-----*/', '\\1<hr />', $text );
 
                $text = $this->doHeadings( $text );
@@ -957,7 +953,7 @@ class Parser
        # The wikilinks [[ ]] are procedeed here.
        /* private */ function replaceInternalLinks( $s ) {
                global $wgLang, $wgLinkCache;
-               global $wgNamespacesWithSubpages, $wgLanguageCode;
+               global $wgNamespacesWithSubpages;
                static $fname = 'Parser::replaceInternalLinks' ;
                wfProfileIn( $fname );
 
@@ -1326,6 +1322,7 @@ class Parser
                                                        $output .= $this->closeParagraph().'<pre>';
                                                        $this->mLastSection = 'pre';
                                                }
+                                               $t = substr( $t, 1 );
                                        } else {
                                                // paragraph
                                                if ( '' == trim($t) ) {
@@ -1700,7 +1697,8 @@ class Parser
                        # Add a new element to the templace recursion path
                        $this->mTemplatePath[$part1] = 1;
 
-                       $text = $this->stripParse( $text, $newline, $assocArgs );
+                       $text = $this->removeHTMLtags( $text );
+                       $text = $this->replaceVariables( $text, $assocArgs );
 
                        # Resume the link cache and register the inclusion as a link
                        if ( !is_null( $title ) ) {
@@ -1727,7 +1725,8 @@ class Parser
                $inputArgs = end( $this->mArgStack );
 
                if ( array_key_exists( $arg, $inputArgs ) ) {
-                       $text = $this->stripParse( $inputArgs[$arg], $newline, array() );
+                       $text = $this->removeHTMLtags( $inputArgs[$arg] );
+                       $text = $this->replaceVariables( $text, array() );
                }
 
                return $text;
@@ -1783,7 +1782,7 @@ class Parser
                $htmlattrs = $this->getHTMLattrs () ;
 
                # Remove HTML comments
-               $text = preg_replace( '/(\\n *<!--.*--> *(?=\\n)|<!--.*-->)/sU', '$2', $text );
+               $text = preg_replace( '/(\\n *<!--.*--> *|<!--.*?-->)/sU', '', $text );
 
                $bits = explode( '<', $text );
                $text = array_shift( $bits );