Revert r103795 -- adds <dws> pseudotag which modifies preprocessor behavior in some...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 23 Nov 2011 00:30:13 +0000 (00:30 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 23 Nov 2011 00:30:13 +0000 (00:30 +0000)
Not sure whether this is something we want, but it should probably be talked over first.

includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
tests/parser/parserTests.txt

index 7803a70..066589f 100644 (file)
@@ -211,9 +211,6 @@ class Preprocessor_DOM implements Preprocessor {
                        $ignoredElements = array( 'includeonly' );
                        $xmlishElements[] = 'includeonly';
                }
-               // `dws' stands for "discard white spaces". `<dws>' and all the whitespaces afer it are
-               // discarded.
-               $xmlishElements[] = 'dws';
                $xmlishRegex = implode( '|', array_merge( $xmlishElements, $ignoredTags ) );
 
                // Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset
@@ -409,20 +406,6 @@ class Preprocessor_DOM implements Preprocessor {
                                }
 
                                $tagStartPos = $i;
-
-                               // Handle tag `dws'.
-                               if ( $name == 'dws' ) {
-                                       $i = $tagEndPos + 1;
-                                       if ( preg_match( '/\s*/', $text, $matches, 0, $i ) ) {
-                                               $i += strlen( $matches[0] );
-                                       }
-                                       $accum .=
-                                               '<ignore>' .
-                                                       htmlspecialchars( substr( $text, $tagStartPos, $i - $tagStartPos ) ) .
-                                               '</ignore>';
-                                       continue;
-                               }
-
                                if ( $text[$tagEndPos-1] == '/' ) {
                                        $attrEnd = $tagEndPos - 1;
                                        $inner = null;
index ad5155b..2934181 100644 (file)
@@ -153,9 +153,6 @@ class Preprocessor_Hash implements Preprocessor {
                        $ignoredElements = array( 'includeonly' );
                        $xmlishElements[] = 'includeonly';
                }
-               // `dws' stands for "discard white spaces". `<dws>' and all the whitespaces afer it are
-               // discarded.
-               $xmlishElements[] = 'dws';
                $xmlishRegex = implode( '|', array_merge( $xmlishElements, $ignoredTags ) );
 
                // Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset
@@ -353,17 +350,6 @@ class Preprocessor_Hash implements Preprocessor {
                                }
 
                                $tagStartPos = $i;
-
-                               // Handle tag dws.
-                               if ( $name == 'dws' ) {
-                                       $i = $tagEndPos + 1;
-                                       if ( preg_match( '/\s*/', $text, $matches, 0, $i ) ) {
-                                               $i += strlen( $matches[0] );
-                                       }
-                                       $accum->addNodeWithText( 'ignore', substr( $text, $tagStartPos, $i - $tagStartPos ) );
-                                       continue;
-                               }
-
                                if ( $text[$tagEndPos-1] == '/' ) {
                                        // Short end tag
                                        $attrEnd = $tagEndPos - 1;
index 1983bf9..78591f7 100644 (file)
@@ -8973,97 +8973,6 @@ title=[[MediaWiki:bug32450.css]]
 </p>
 !! end
 
-!! test
-Bug 31865: HTML-style tag <dws> is recognized and discarded.
-!! input
-one<dws>two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: XML-style tag <dws/> is recognized and discarded.
-!! input
-one<dws/>two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: Spaces after <dws> tag are discarded.
-!! input
-one<dws>   two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: Tabs after <dws> tag are discarded too.
-!! input
-one<dws>                       two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: Newlines after <dws> tag are discarded too.
-!! input
-one<dws>
-
-
-two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: Spaces before <dws> tag are not discarded.
-!! input
-one   <dws>two
-!! result
-<p>one   two
-</p>
-!! end
-
-!! test
-Bug 31865: <dws> Continuation is indented.
-!! input
-one<dws>
-       two
-!! result
-<p>onetwo
-</p>
-!! end
-
-!! test
-Bug 31865: <dws> List item continuation.
-!! input
-* one<dws>
-       two
-* three
-!! result
-<ul><li> onetwo
-</li><li> three
-</li></ul>
-
-!! end
-
-!! test
-Bug 31865: <dws/> XML-style; asterisk after the tag does not start list item. 
-!! input
-* one <dws/>
-* two
-!! result
-<ul><li> one * two
-</li></ul>
-
-!! end
-
 TODO:
 more images
 more tables