From 9fd6bb839352c2ae14a80c6f6969de7999713637 Mon Sep 17 00:00:00 2001 From: Fran Rogers Date: Mon, 12 Jan 2009 07:45:34 +0000 Subject: [PATCH] --- RELEASE-NOTES | 3 +++ includes/parser/Parser.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 86228787ff..74ee44604b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -31,6 +31,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN passing "uploadmsg" parameter in the url * (bug 9947) Add PROTECTIONLEVEL parser funtion to return the protection level for the current page for a given action +* Added "__\" magic word to eat up all whitespace and newlines to the next + non-whitespace character, to facilitate writing readable template code where + whitespace is significant. === Bug fixes in 1.15 === * Fixing the caching issue by using -{T|xxx}- syntax (only applies on wiki with LanguageConverter class) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 07d449e2d3..504660a963 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -327,6 +327,12 @@ class Parser $text = $this->internalParse( $text ); $text = $this->mStripState->unstripGeneral( $text ); + # To make wikitext easier to read where significant + # whitespace is a problem, '__\' will be eaten up along with + # all whitespace and newlines that follow it, up to the next + # non-whitespace character. (Compare 'dnl' from m4.) + $text = preg_replace('/__\\\\\s*/', '', $text); + # Clean up special characters, only run once, next-to-last before doBlockLevels $fixtags = array( # french spaces, last one Guillemet-left -- 2.20.1