https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112458
Revision: 112458
Author: krinkle
Date: 2012-02-27 00:09:59 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
[CodeReview/DiffHighlighter] Restore inline wrapper for diff text
* Restore inline wrapper for diff text to allow styling of the diff text with
the correct inline content width (style for td.ins/td.del styles the entire
line rather than just the text)
* Use Html::element() consistently in both the top and bottom of formatLine()
for the line-numbers. No need to allow raw html in td.linenumbers, and if it
does it should be documented and also allowed in other parts of the code.
* main change:
- Html::Element( 'td', $classAttr, $content )
// $inlineWrapEl is span, ins or del
+ Html::rawElement( 'td', $classAttr, Html::element( $inlineWrapEl, array() ,
$content ) )
Modified Paths:
--------------
trunk/extensions/CodeReview/backend/DiffHighlighter.php
Modified: trunk/extensions/CodeReview/backend/DiffHighlighter.php
===================================================================
--- trunk/extensions/CodeReview/backend/DiffHighlighter.php 2012-02-27
00:03:14 UTC (rev 112457)
+++ trunk/extensions/CodeReview/backend/DiffHighlighter.php 2012-02-27
00:09:59 UTC (rev 112458)
@@ -86,18 +86,19 @@
function formatLine( $content, $class = null ) {
- if( is_null($class) ) {
+ if ( $class === null ) {
return Html::rawElement( 'tr', $this->getLineIdAttr(),
- Html::Element( 'td', array(
'class'=>'linenumbers' ), $this->left )
- . Html::Element( 'td', array(
'class'=>'linenumbers' ), $this->right )
- . Html::Element( 'td', array() ,
$content )
+ Html::element( 'td', array( 'class'
=> 'linenumbers' ), $this->left )
+ . Html::element( 'td', array( 'class'
=> 'linenumbers' ), $this->right )
+ . Html::rawElement( 'td', array() ,
Html::element( 'span', array() , $content ) )
);
}
# Skip line number when they do not apply
$left = $right = ' ';
+ $inlineWrapEl = 'span';
- switch( $class ) {
+ switch ( $class ) {
case 'chunkdelimiter':
$left = $right = '—';
break;
@@ -107,20 +108,22 @@
break;
case 'del':
$left = $this->left;
+ $inlineWrapEl = 'del';
break;
case 'ins':
$right = $this->right;
+ $inlineWrapEl = 'ins';
break;
default:
# Rely on $left, $right initialization above
}
- $classAttr = is_null($class) ? array() : array( 'class' =>
$class );
+ $classAttr = is_null( $class ) ? array() : array( 'class' =>
$class );
return Html::rawElement( 'tr', $this->getLineIdAttr(),
- Html::rawElement( 'td', array(
'class'=>'linenumbers' ), $left )
- . Html::rawElement( 'td', array(
'class'=>'linenumbers' ), $right )
- . Html::Element( 'td', $classAttr, $content )
+ Html::element( 'td', array( 'class' =>
'linenumbers' ), $left )
+ . Html::element( 'td', array( 'class' =>
'linenumbers' ), $right )
+ . Html::rawElement( 'td', $classAttr ,
Html::element( $inlineWrapEl, array() , $content ) )
);
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs