InlineRenderer
extends Renderer
in package
"Inline" diff renderer.
This class renders diffs in the Wiki-style "inline" format.
Copyright 2004-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Tags
Table of Contents
- $_block_header : string
- Header for each change block.
- $_del_prefix : string
- Prefix for deleted text.
- $_del_suffix : string
- Suffix for deleted text.
- $_ins_prefix : string
- Prefix for inserted text.
- $_ins_suffix : string
- Suffix for inserted text.
- $_leading_context_lines : int
- Number of leading context "lines" to preserve.
- $_split_characters : bool
- Whether to split down to character-level.
- $_split_level : string
- What are we currently splitting on? Used to recurse to show word-level or character-level changes.
- $_trailing_context_lines : int
- Number of trailing context "lines" to preserve.
- __construct() : mixed
- Constructor.
- getParams() : array<string|int, mixed>
- Get any renderer parameters.
- render() : string
- Renders a diff.
- _added() : string
- Glues array of added lines to a >-prefixed string
- _block() : string
- Render a diff block
- _blockHeader() : string
- Render a Diff Block Header
- _changed() : string
- Produces a comparison string out of arrays of deleted and added lines
- _context() : string
- Glues array of context lines to a space-prefixed string
- _deleted() : string
- Glues array of added lines to a >-prefixed string
- _encode() : mixed
- _endBlock() : string
- _endDiff() : string
- _lines() : string
- Glue an array of lines to a string with prefixed lines
- _splitOnWords() : mixed
- _startBlock() : string
- _startDiff() : string
Properties
$_block_header
Header for each change block.
protected
string
$_block_header
= ''
$_del_prefix
Prefix for deleted text.
protected
string
$_del_prefix
= '<del>'
$_del_suffix
Suffix for deleted text.
protected
string
$_del_suffix
= '</del>'
$_ins_prefix
Prefix for inserted text.
protected
string
$_ins_prefix
= '<ins>'
$_ins_suffix
Suffix for inserted text.
protected
string
$_ins_suffix
= '</ins>'
$_leading_context_lines
Number of leading context "lines" to preserve.
protected
int
$_leading_context_lines
= 10000
$_split_characters
Whether to split down to character-level.
protected
bool
$_split_characters
= false
$_split_level
What are we currently splitting on? Used to recurse to show word-level or character-level changes.
protected
string
$_split_level
= 'lines'
$_trailing_context_lines
Number of trailing context "lines" to preserve.
protected
int
$_trailing_context_lines
= 10000
Methods
__construct()
Constructor.
public
__construct([mixed $params = [] ]) : mixed
Parameters
- $params : mixed = []
Return values
mixed —getParams()
Get any renderer parameters.
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed> —All parameters of this renderer object.
render()
Renders a diff.
public
render(Diff $diff) : string
Parameters
- $diff : Diff
-
A Horde_Text_Diff object.
Return values
string —The formatted output.
_added()
Glues array of added lines to a >-prefixed string
protected
_added([array<string|int, mixed> $lines = [] ]) : string
Parameters
- $lines : array<string|int, mixed> = []
Return values
string —_block()
Render a diff block
protected
_block(int $xbeg, int $xlen, int $ybeg, int $ylen, mixed &$edits) : string
Parameters
- $xbeg : int
- $xlen : int
- $ybeg : int
- $ylen : int
- $edits : mixed
-
Should be a list object rather than a writeable array reference
Return values
string —_blockHeader()
Render a Diff Block Header
protected
_blockHeader(int $xbeg, int $xlen, int $ybeg, int $ylen) : string
Headers look like: 186,187c180,181 or 204c198
Parameters
- $xbeg : int
- $xlen : int
- $ybeg : int
- $ylen : int
Return values
string —_changed()
Produces a comparison string out of arrays of deleted and added lines
protected
_changed([array<string|int, mixed> $orig = [] ][, array<string|int, mixed> $final = [] ]) : string
Parameters
- $orig : array<string|int, mixed> = []
- $final : array<string|int, mixed> = []
Return values
string —_context()
Glues array of context lines to a space-prefixed string
protected
_context([array<string|int, mixed> $lines = [] ]) : string
Parameters
- $lines : array<string|int, mixed> = []
Return values
string —_deleted()
Glues array of added lines to a >-prefixed string
protected
_deleted([array<string|int, mixed> $lines = [] ]) : string
Parameters
- $lines : array<string|int, mixed> = []
Return values
string —_encode()
protected
_encode(string &$string) : mixed
Parameters
- $string : string
Return values
mixed —_endBlock()
protected
_endBlock() : string
Return values
string —_endDiff()
protected
_endDiff() : string
Return values
string —_lines()
Glue an array of lines to a string with prefixed lines
protected
_lines([array<string|int, mixed> $lines = [] ][, string $prefix = ' ' ][, mixed $encode = true ]) : string
Parameters
- $lines : array<string|int, mixed> = []
- $prefix : string = ' '
-
defaults to a single space
- $encode : mixed = true
Return values
string —_splitOnWords()
protected
_splitOnWords(string $string[, string $newlineEscape = "
" ]) : mixed
Parameters
- $string : string
- $newlineEscape : string = " "
Return values
mixed —_startBlock()
protected
_startBlock(string $header) : string
Parameters
- $header : string
Return values
string —_startDiff()
protected
_startDiff() : string