From 27b5141563906d369db232f1dbfa4a1ed82ea460 Mon Sep 17 00:00:00 2001 From: Paul Copperman Date: Tue, 7 Jun 2011 15:12:26 +0000 Subject: [PATCH] Another try at fixing bug 93 "tilde signatures inside nowiki tags sometimes get expanded (~~~~)" * Change the preprocessor to insert strip items for nodes during pre-save-transform, just like nodes are handled already. This effectively disables all pre-save-transform steps inside tags. * Adapt parser tests to the new behavior. --- RELEASE-NOTES-1.19 | 2 ++ includes/parser/Preprocessor_DOM.php | 5 ++++- includes/parser/Preprocessor_Hash.php | 5 ++++- tests/parser/parserTests.txt | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 4577727668..fa7cfbcaf0 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -86,6 +86,8 @@ production. * (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 + (~~~~) === API changes in 1.19 === * BREAKING CHANGE: action=watch now requires POST and token. diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 48c234575f..537abe9891 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -1089,8 +1089,11 @@ class PPFrame_DOM implements PPFrame { # OT_WIKI will only respect 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 .= ''; } diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index c2d7d3d8de..77fe7c9a63 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -1019,8 +1019,11 @@ class PPFrame_Hash implements PPFrame { # OT_WIKI will only respect 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 .= ''; } diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 492d64699b..f90c523b7d 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3926,7 +3926,7 @@ pst !! result * [[Special:Contributions/127.0.0.1|127.0.0.1]] * [[Special:Contributions/127.0.0.1|127.0.0.1]] -* [[Special:Contributions/127.0.0.1|127.0.0.1]] +* ~~~ * [[Special:Contributions/127.0.0.1|127.0.0.1]] !! end @@ -3934,7 +3934,7 @@ pst !! test pre-save transform: Signature expansion in nowiki tags (bug 93) !! options -pst disabled +pst !! input Shall not expand: -- 2.20.1