From: Rob Church Date: Mon, 18 Dec 2006 19:30:26 +0000 (+0000) Subject: * (bug 8310) Blank line added to top of 'post' when page is blank X-Git-Tag: 1.31.0-rc.0~54848 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=16cdbfd22248217b831249addcf28cb030122767;p=lhc%2Fweb%2Fwiklou.git * (bug 8310) Blank line added to top of 'post' when page is blank --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7fe83fd42a..e19b27ee76 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -344,6 +344,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 2785) Accept optional colon prefix in links when formatting comments * Don't show "you can view and copy the source of this page" message for pages which don't exist +* (bug 8310) Blank line added to top of 'post' when page is blank == Languages updated == diff --git a/includes/Article.php b/includes/Article.php index 1e2a9a6496..0ebd440097 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1134,13 +1134,18 @@ class Article { } $oldtext = $rev->getText(); - if($section=='new') { - if($summary) $subject="== {$summary} ==\n\n"; - $text=$oldtext."\n\n".$subject.$text; + if( $section == 'new' ) { + # Inserting a new section + $subject = $summary ? "== {$summary} ==\n\n" : ''; + $text = strlen( trim( $oldtext ) ) > 0 + ? "{$oldtext}\n\n{$subject}{$text}" + : "{$oldtext}{$subject}{$text}"; } else { + # Replacing an existing section; roll out the big guns global $wgParser; $text = $wgParser->replaceSection( $oldtext, $section, $text ); } + } wfProfileOut( __METHOD__ );