3
* "Context" diff renderer.
5
* This class renders the diff in classic "context diff" format.
7
* $Horde: framework/Text_Diff/Diff/Renderer/context.php,v 1.3.2.3 2008/01/04 10:37:27 jan Exp $
9
* Copyright 2004-2008 The Horde Project (http://www.horde.org/)
11
* See the enclosed file COPYING for license information (LGPL). If you did
12
* not receive this file, see http://opensource.org/licenses/lgpl-license.php.
17
/** Text_Diff_Renderer */
18
require_once 'Text/Diff/Renderer.php';
23
class Text_Diff_Renderer_context extends Text_Diff_Renderer {
26
* Number of leading context "lines" to preserve.
28
var $_leading_context_lines = 4;
31
* Number of trailing context "lines" to preserve.
33
var $_trailing_context_lines = 4;
35
var $_second_block = '';
37
function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
45
$this->_second_block = "--- $ybeg ----\n";
46
return "***************\n*** $xbeg ****";
51
return $this->_second_block;
54
function _context($lines)
56
$this->_second_block .= $this->_lines($lines, ' ');
57
return $this->_lines($lines, ' ');
60
function _added($lines)
62
$this->_second_block .= $this->_lines($lines, '+ ');
66
function _deleted($lines)
68
return $this->_lines($lines, '- ');
71
function _changed($orig, $final)
73
$this->_second_block .= $this->_lines($final, '! ');
74
return $this->_lines($orig, '! ');