From d60063eac21f7f34e209e7cc58453c9b69031d78 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 23 Nov 2011 00:30:13 +0000 Subject: [PATCH] Revert r103795 -- adds pseudotag which modifies preprocessor behavior in some way to eat whitespace Not sure whether this is something we want, but it should probably be talked over first. --- includes/parser/Preprocessor_DOM.php | 17 ----- includes/parser/Preprocessor_Hash.php | 14 ----- tests/parser/parserTests.txt | 91 --------------------------- 3 files changed, 122 deletions(-) diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 7803a70ec0..066589f685 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -211,9 +211,6 @@ class Preprocessor_DOM implements Preprocessor { $ignoredElements = array( 'includeonly' ); $xmlishElements[] = 'includeonly'; } - // `dws' stands for "discard white spaces". `' 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 .= - '' . - htmlspecialchars( substr( $text, $tagStartPos, $i - $tagStartPos ) ) . - ''; - continue; - } - if ( $text[$tagEndPos-1] == '/' ) { $attrEnd = $tagEndPos - 1; $inner = null; diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index ad5155b8e2..2934181a50 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -153,9 +153,6 @@ class Preprocessor_Hash implements Preprocessor { $ignoredElements = array( 'includeonly' ); $xmlishElements[] = 'includeonly'; } - // `dws' stands for "discard white spaces". `' 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; diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 1983bf924c..78591f7022 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -8973,97 +8973,6 @@ title=[[MediaWiki:bug32450.css]]

!! end -!! test -Bug 31865: HTML-style tag is recognized and discarded. -!! input -onetwo -!! result -

onetwo -

-!! end - -!! test -Bug 31865: XML-style tag is recognized and discarded. -!! input -onetwo -!! result -

onetwo -

-!! end - -!! test -Bug 31865: Spaces after tag are discarded. -!! input -one two -!! result -

onetwo -

-!! end - -!! test -Bug 31865: Tabs after tag are discarded too. -!! input -one two -!! result -

onetwo -

-!! end - -!! test -Bug 31865: Newlines after tag are discarded too. -!! input -one - - -two -!! result -

onetwo -

-!! end - -!! test -Bug 31865: Spaces before tag are not discarded. -!! input -one two -!! result -

one two -

-!! end - -!! test -Bug 31865: Continuation is indented. -!! input -one - two -!! result -

onetwo -

-!! end - -!! test -Bug 31865: List item continuation. -!! input -* one - two -* three -!! result -
  • onetwo -
  • three -
- -!! end - -!! test -Bug 31865: XML-style; asterisk after the tag does not start list item. -!! input -* one -* two -!! result -
  • one * two -
- -!! end - TODO: more images more tables -- 2.20.1