http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89648

Revision: 89648
Author:   pcopp
Date:     2011-06-07 15:12:26 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
Another try at fixing bug 93 "tilde signatures inside nowiki tags sometimes get 
expanded (<includeonly><nowiki>~~~~</nowiki></includeonly>)"

* Change the preprocessor to insert strip items for <ignore> nodes during 
pre-save-transform, just like <comment> nodes are handled already. This 
effectively disables all pre-save-transform steps inside <includeonly> tags.
* Adapt parser tests to the new behavior.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.19
    trunk/phase3/includes/parser/Preprocessor_DOM.php
    trunk/phase3/includes/parser/Preprocessor_Hash.php
    trunk/phase3/tests/parser/parserTests.txt

Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19     2011-06-07 14:44:54 UTC (rev 89647)
+++ trunk/phase3/RELEASE-NOTES-1.19     2011-06-07 15:12:26 UTC (rev 89648)
@@ -86,6 +86,8 @@
 * (bug 29101) Special:FileDuplicateSearch shows silly message
 * (bug 29048) jQuery.tabIndex: firstTabIndex() should not output the same
   as lastTabIndex().
+* (bug 93) tilde signatures inside nowiki tags sometimes get expanded
+  (<includeonly><nowiki>~~~~</nowiki></includeonly>)
 
 === API changes in 1.19 ===
 * BREAKING CHANGE: action=watch now requires POST and token.

Modified: trunk/phase3/includes/parser/Preprocessor_DOM.php
===================================================================
--- trunk/phase3/includes/parser/Preprocessor_DOM.php   2011-06-07 14:44:54 UTC 
(rev 89647)
+++ trunk/phase3/includes/parser/Preprocessor_DOM.php   2011-06-07 15:12:26 UTC 
(rev 89648)
@@ -1089,8 +1089,11 @@
                                        # OT_WIKI will only respect <ignore> in 
substed templates.
                                        # The other output types respect it 
unless NO_IGNORE is set.
                                        # extractSections() sets NO_IGNORE and 
so never respects it.
-                                       if ( ( !isset( $this->parent ) && 
$this->parser->ot['wiki'] ) || ( $flags & PPFrame::NO_IGNORE ) ) {
+                                       if ( $flags & PPFrame::NO_IGNORE ) {
                                                $out .= 
$contextNode->textContent;
+                                       # Add a strip marker in PST mode so 
that pstPass2() can run some old-fashioned regexes on the result
+                                       } elseif ( !isset( $this->parent ) && 
$this->parser->ot['wiki'] ) {
+                                               $out .= 
$this->parser->insertStripItem( $contextNode->textContent );
                                        } else {
                                                $out .= '';
                                        }

Modified: trunk/phase3/includes/parser/Preprocessor_Hash.php
===================================================================
--- trunk/phase3/includes/parser/Preprocessor_Hash.php  2011-06-07 14:44:54 UTC 
(rev 89647)
+++ trunk/phase3/includes/parser/Preprocessor_Hash.php  2011-06-07 15:12:26 UTC 
(rev 89648)
@@ -1019,8 +1019,11 @@
                                        # OT_WIKI will only respect <ignore> in 
substed templates.
                                        # The other output types respect it 
unless NO_IGNORE is set.
                                        # extractSections() sets NO_IGNORE and 
so never respects it.
-                                       if ( ( !isset( $this->parent ) && 
$this->parser->ot['wiki'] ) || ( $flags & PPFrame::NO_IGNORE ) ) {
+                                       if ( $flags & PPFrame::NO_IGNORE ) {
                                                $out .= 
$contextNode->firstChild->value;
+                                       # Add a strip marker in PST mode so 
that pstPass2() can run some old-fashioned regexes on the result
+                                       } elseif ( !isset( $this->parent ) && 
$this->parser->ot['wiki'] ) {
+                                               $out .= 
$this->parser->insertStripItem( $contextNode->firstChild->value );
                                        } else {
                                                //$out .= '';
                                        }

Modified: trunk/phase3/tests/parser/parserTests.txt
===================================================================
--- trunk/phase3/tests/parser/parserTests.txt   2011-06-07 14:44:54 UTC (rev 
89647)
+++ trunk/phase3/tests/parser/parserTests.txt   2011-06-07 15:12:26 UTC (rev 
89648)
@@ -3926,7 +3926,7 @@
 !! result
 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
-* <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
+* <includeonly>~~~</includeonly>
 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
 !! end
 
@@ -3934,7 +3934,7 @@
 !! test
 pre-save transform: Signature expansion in nowiki tags (bug 93)
 !! options
-pst disabled
+pst
 !! input
 Shall not expand:
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to