From 11a2818cefc3997e51079470dfad389aa0a48777 Mon Sep 17 00:00:00 2001 From: sahajsk Date: Sat, 12 Feb 2022 17:47:37 +0530 Subject: [PATCH] Display newline character as arrow symbol in target string Change-Id: Iccddd19d708d89a43ea97320b95af9f513ddd73a --- src/SpecialReplaceText.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/SpecialReplaceText.php b/src/SpecialReplaceText.php index 8436446a..fd2702cf 100644 --- a/src/SpecialReplaceText.php +++ b/src/SpecialReplaceText.php @@ -33,6 +33,7 @@ use Xml; class SpecialReplaceText extends SpecialPage { private $target; + private $targetString; private $replacement; private $use_regex; private $category; @@ -104,6 +105,7 @@ class SpecialReplaceText extends SpecialPage { $request = $this->getRequest(); $this->target = $request->getText( 'target' ); + $this->targetString = preg_replace( "/\\n/", "↵", $this->target ); $this->replacement = $request->getText( 'replacement' ); $this->use_regex = $request->getBool( 'use_regex' ); $this->category = $request->getText( 'category' ); @@ -141,7 +143,7 @@ class SpecialReplaceText extends SpecialPage { $count = $this->getLanguage()->formatNum( count( $jobs ) ); $out->addWikiMsg( 'replacetext_success', - "{$this->target}", + "{$this->targetString}", "{$this->replacement}", $count ); @@ -200,12 +202,12 @@ class SpecialReplaceText extends SpecialPage { if ( $this->edit_pages && $category_title_exists ) { $out->addWikiMsg( 'replacetext_noreplacement', - "{$this->target}" + "{$this->targetString}" ); } if ( $this->move_pages && $category_title_exists ) { - $out->addWikiMsg( 'replacetext_nomove', "{$this->target}" ); + $out->addWikiMsg( 'replacetext_nomove', "{$this->targetString}" ); } // link back to starting form $out->addHTML( @@ -259,7 +261,7 @@ class SpecialReplaceText extends SpecialPage { $replacement_params['use_regex'] = $this->use_regex; $replacement_params['edit_summary'] = $this->msg( 'replacetext_editsummary', - $this->target, $this->replacement + $this->targetString, $this->replacement )->inContentLanguage()->plain(); $replacement_params['create_redirect'] = false; $replacement_params['watch_page'] = false; @@ -693,7 +695,7 @@ class SpecialReplaceText extends SpecialPage { if ( count( $titles_for_edit ) > 0 ) { $out->addWikiMsg( 'replacetext_choosepagesforedit', - "{$this->target}", + "{$this->targetString}", "{$this->replacement}", $wgLang->formatNum( count( $titles_for_edit ) ) ); @@ -727,7 +729,7 @@ class SpecialReplaceText extends SpecialPage { if ( count( $titles_for_move ) > 0 ) { $out->addWikiMsg( 'replacetext_choosepagesformove', - $this->target, $this->replacement, $wgLang->formatNum( count( $titles_for_move ) ) + $this->targetString, $this->replacement, $wgLang->formatNum( count( $titles_for_move ) ) ); foreach ( $titles_for_move as $title ) { $out->addHTML(