jablonka.czprosek.czf

websvn

Subversion Repositories:
[/] [lib/] [pear/] [Text/] [Diff/] [Renderer/] [context.php] - Blame information for rev 5

 

Line No. Rev Author Line
15simandl<?php
2/**
3 * "Context" diff renderer.
4 *
5 * This class renders the diff in classic "context diff" format.
6 *
7 * $Horde: framework/Text_Diff/Diff/Renderer/context.php,v 1.3.2.3 2008/01/04 10:37:27 jan Exp $
8 *
9 * Copyright 2004-2008 The Horde Project (http://www.horde.org/)
10 *
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.
13 *
14 * @package Text_Diff
15 */
16 
17/** Text_Diff_Renderer */
18require_once 'Text/Diff/Renderer.php';
19 
20/**
21 * @package Text_Diff
22 */
23class Text_Diff_Renderer_context extends Text_Diff_Renderer {
24 
25 /**
26 * Number of leading context "lines" to preserve.
27 */
28 var $_leading_context_lines = 4;
29 
30 /**
31 * Number of trailing context "lines" to preserve.
32 */
33 var $_trailing_context_lines = 4;
34 
35 var $_second_block = '';
36 
37 function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
38 {
39 if ($xlen != 1) {
40 $xbeg .= ',' . $xlen;
41 }
42 if ($ylen != 1) {
43 $ybeg .= ',' . $ylen;
44 }
45 $this->_second_block = "--- $ybeg ----\n";
46 return "***************\n*** $xbeg ****";
47 }
48 
49 function _endBlock()
50 {
51 return $this->_second_block;
52 }
53 
54 function _context($lines)
55 {
56 $this->_second_block .= $this->_lines($lines, ' ');
57 return $this->_lines($lines, ' ');
58 }
59 
60 function _added($lines)
61 {
62 $this->_second_block .= $this->_lines($lines, '+ ');
63 return '';
64 }
65 
66 function _deleted($lines)
67 {
68 return $this->_lines($lines, '- ');
69 }
70 
71 function _changed($orig, $final)
72 {
73 $this->_second_block .= $this->_lines($final, '! ');
74 return $this->_lines($orig, '! ');
75 }
76 
77}

Powered by WebSVN 2.2.1