From: Raimond Spekking Date: Tue, 22 May 2007 21:39:57 +0000 (+0000) Subject: * (bug 6072) Add a 'border' keyword to the image syntax X-Git-Tag: 1.31.0-rc.0~52819 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=e67b6e6a6ad17898f9d85bccc75a6539ef49114e;p=lhc%2Fweb%2Fwiklou.git * (bug 6072) Add a 'border' keyword to the image syntax Usage: [[Image:filename.jpg|border|right|100px]] --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a6ef8a62ba..8928784580 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -39,6 +39,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN related to landscape images on a page without nailing the width of upright images to a fix value which makes views for anon unproportional and user preferences useless +* (bug 6072) Add a 'border' keyword to the image syntax == Bugfixes since 1.10 == diff --git a/includes/Linker.php b/includes/Linker.php index bd5b413c26..8575403e8a 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -414,7 +414,7 @@ class Linker { /** @todo document */ function makeImageLinkObj( $nt, $label, $alt, $align = '', $params = array(), $framed = false, - $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0 ) + $thumb = false, $manual_thumb = '', $valign = '', $upright = false, $upright_factor = 0, $border = false ) { global $wgContLang, $wgUser, $wgThumbLimits, $wgThumbUpright; @@ -485,8 +485,12 @@ class Linker { 'alt' => $alt, 'longdesc' => $u ); + + $borderStyle = $border ? 'border: solid 1px #dddddd;' : ''; if ( $valign ) { - $imgAttribs['style'] = "vertical-align: $valign"; + $imgAttribs['style'] = "$borderStyle vertical-align: $valign"; + } elseif ( $border ) { + $imgAttribs['style'] = "$borderStyle"; } $linkAttribs = array( 'href' => $u, diff --git a/includes/Parser.php b/includes/Parser.php index c9f23a17e6..0a7e86260e 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4413,6 +4413,7 @@ class Parser # * center center the image # * framed Keep original image size, no magnify-button. # * upright reduce width for upright images, rounded to full __0 px + # * border draw a 1px border around the image # vertical-align values (no % or length right now): # * baseline # * sub @@ -4436,6 +4437,7 @@ class Parser $mwWidth =& MagicWord::get( 'img_width' ); $mwFramed =& MagicWord::get( 'img_framed' ); $mwUpright =& MagicWord::get( 'img_upright' ); + $mwBorder =& MagicWord::get( 'img_border' ); $mwPage =& MagicWord::get( 'img_page' ); $caption = ''; @@ -4443,6 +4445,7 @@ class Parser $framed = $thumb = false; $upright = false; $upright_factor = 0; + $border = false; $manual_thumb = '' ; $align = $valign = ''; $sk = $this->mOptions->getSkin(); @@ -4453,6 +4456,8 @@ class Parser } elseif ( !is_null( $match = $mwUpright->matchVariableStartToEnd( $val ) ) ) { $upright = true; $upright_factor = floatval( $match ); + } elseif ( !is_null( $mwBorder->matchVariableStartToEnd( $val ) ) ) { + $border = true; } elseif ( ! is_null( $match = $mwManualThumb->matchVariableStartToEnd($val) ) ) { # use manually specified thumbnail $thumb=true; @@ -4499,7 +4504,7 @@ class Parser $alt = Sanitizer::stripAllTags( $alt ); # Linker does the rest - return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor ); + return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $params, $framed, $thumb, $manual_thumb, $valign, $upright, $upright_factor, $border ); } /** diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index e7cfa6f321..fa5edfe074 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -283,6 +283,7 @@ $magicWords = array( 'img_framed' => array( 1, 'framed', 'enframed', 'frame' ), 'img_page' => array( 1, 'page=$1', 'page $1' ), 'img_upright' => array( 1, 'upright', 'upright=$1', 'upright $1' ), + 'img_border' => array( 1, 'border' ), 'img_baseline' => array( 1, 'baseline' ), 'img_sub' => array( 1, 'sub' ), 'img_super' => array( 1, 'super', 'sup' ),