From 629df89813e0cb277eeeb94205f819df53413c01 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Sat, 23 Apr 2011 13:23:08 +0000 Subject: [PATCH] Embrace comment with () only when really needed. In Special:ListFiles and ImagePage the comment is shown alone in a table cell -> no () needed --- includes/ImagePage.php | 2 +- includes/Linker.php | 9 ++++++--- includes/specials/SpecialListfiles.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index ad3a5a73eb..6d4aedf114 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -1097,7 +1097,7 @@ class ImageHistoryList { if ( $file->isDeleted( File::DELETED_COMMENT ) ) { $row .= '' . wfMsgHtml( 'rev-deleted-comment' ) . ''; } else { - $row .= $this->skin->commentBlock( $description, $this->title ); + $row .= $this->skin->commentBlock( $description, $this->title, false, false ); } $row .= ''; diff --git a/includes/Linker.php b/includes/Linker.php index 7c9031ac41..b430db1be7 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1292,10 +1292,10 @@ class Linker { * @param $comment String * @param $title Mixed: Title object (to generate link to section in autocomment) or null * @param $local Boolean: whether section links should refer to local page - * + * @param $embraced Boolean: whether the formatted comment should be embraced with () * @return string */ - static function commentBlock( $comment, $title = null, $local = false ) { + static function commentBlock( $comment, $title = null, $local = false, $embraced = true ) { // '*' used to be the comment inserted by the software way back // in antiquity in case none was provided, here for backwards // compatability, acc. to brion -ævar @@ -1303,7 +1303,10 @@ class Linker { return ''; } else { $formatted = self::formatComment( $comment, $title, $local ); - return " ($formatted)"; + if ( $embraced ) { + $formatted = wfMessage( 'parentheses', $formatted ); + } + return Html::rawElement( 'span', array( 'class' => 'comment' ), $formatted ); } } diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 9bc38cdf73..ca6e8aa3b2 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -215,7 +215,7 @@ class ImageListPager extends TablePager { case 'img_size': return $this->getSkin()->formatSize( $value ); case 'img_description': - return $this->getSkin()->commentBlock( $value ); + return $this->getSkin()->commentBlock( $value, null, false, false ); case 'count': return intval($value)+1; } -- 2.20.1