From ebbee769bfd932562990e24241cc898ac6d58076 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 8 Aug 2008 10:24:09 +0000 Subject: [PATCH] * (bug 2443) Add image name as alt-text when no caption is provided. --- RELEASE-NOTES | 1 + includes/parser/Parser.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f688f43168..96650b7bba 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -78,6 +78,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN Patch by Max Semenik. * (bug 15055) Talk page notifications no longer attempt to send mail when user's e-mail address is invalid or unconfirmed +* (bug 2443) Add image name as alt-text when no caption is provided. === API changes in 1.14 === diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7a2f5f7134..0648040296 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4517,7 +4517,7 @@ class Parser list( $paramMap, $mwArray ) = $this->getImageParams( $handler ); # Process the input parameters - $caption = ''; + $caption = false; $params = array( 'frame' => array(), 'handler' => array(), 'horizAlign' => array(), 'vertAlign' => array() ); foreach( $parts as $part ) { @@ -4584,9 +4584,15 @@ class Parser if ( $params['vertAlign'] ) { $params['frame']['valign'] = key( $params['vertAlign'] ); } - - # Strip bad stuff out of the alt text - $alt = $this->replaceLinkHoldersText( $caption ); + + // Process alt text + if ($caption === false) { + // Put the image name in. + $alt = $title->getPrefixedText(); + } else { + # Strip bad stuff out of the alt text + $alt = $this->replaceLinkHoldersText( $caption ); + } # make sure there are no placeholders in thumbnail attributes # that are later expanded to html- so expand them now and -- 2.20.1