fix for Bug #93 “tilde signatures inside nowiki tags sometimes get expanded (<include...
[lhc/web/wiklou.git] / includes / parser / Preprocessor_Hash.php
index fbbc218..7f175e5 100644 (file)
@@ -24,10 +24,17 @@ class Preprocessor_Hash implements Preprocessor {
                $this->parser = $parser;
        }
 
+       /**
+        * @return PPFrame_Hash
+        */
        function newFrame() {
                return new PPFrame_Hash( $this );
        }
 
+       /**
+        * @param $args
+        * @return PPCustomFrame_Hash
+        */
        function newCustomFrame( $args ) {
                return new PPCustomFrame_Hash( $this, $args );
        }
@@ -137,6 +144,9 @@ class Preprocessor_Hash implements Preprocessor {
                        if ( strpos( $text, '<onlyinclude>' ) !== false && strpos( $text, '</onlyinclude>' ) !== false ) {
                                $enableOnlyinclude = true;
                        }
+               } else if ( $this->parser->ot['wiki'] ) {
+                       $ignoredTags = array( 'noinclude', '/noinclude', 'onlyinclude', '/onlyinclude', 'includeonly', '/includeonly' );
+                       $ignoredElements = array();
                } else {
                        $ignoredTags = array( 'noinclude', '/noinclude', 'onlyinclude', '/onlyinclude' );
                        $ignoredElements = array( 'includeonly' );
@@ -304,13 +314,11 @@ class Preprocessor_Hash implements Preprocessor {
 
                                                if ( $stack->top ) {
                                                        $part = $stack->top->getCurrentPart();
-                                                       if ( isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 ) {
-                                                               // Comments abutting, no change in visual end
-                                                               $part->commentEnd = $wsEnd;
-                                                       } else {
+                                                       if ( ! (isset( $part->commentEnd ) && $part->commentEnd == $wsStart - 1 )) {
                                                                $part->visualEnd = $wsStart;
-                                                               $part->commentEnd = $endPos;
                                                        }
+                                                       // Else comments abutting, no change in visual end
+                                                       $part->commentEnd = $endPos;
                                                }
                                                $i = $endPos + 1;
                                                $inner = substr( $text, $startPos, $endPos - $startPos + 1 );
@@ -1233,6 +1241,13 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
        var $numberedArgs, $namedArgs, $parent;
        var $numberedExpansionCache, $namedExpansionCache;
 
+       /**
+        * @param $preprocessor
+        * @param $parent
+        * @param $numberedArgs array
+        * @param $namedArgs array
+        * @param $title Title
+        */
        function __construct( $preprocessor, $parent = false, $numberedArgs = array(), $namedArgs = array(), $title = false ) {
                parent::__construct( $preprocessor );
 
@@ -1269,11 +1284,16 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
        }
        /**
         * Returns true if there are no arguments in this frame
+        *
+        * @return bool
         */
        function isEmpty() {
                return !count( $this->numberedArgs ) && !count( $this->namedArgs );
        }
 
+       /**
+        * @return array
+        */
        function getArguments() {
                $arguments = array();
                foreach ( array_merge(
@@ -1284,6 +1304,9 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
                return $arguments;
        }
 
+       /**
+        * @return array
+        */
        function getNumberedArguments() {
                $arguments = array();
                foreach ( array_keys($this->numberedArgs) as $key ) {
@@ -1292,6 +1315,9 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
                return $arguments;
        }
 
+       /**
+        * @return array
+        */
        function getNamedArguments() {
                $arguments = array();
                foreach ( array_keys($this->namedArgs) as $key ) {