NAME
Konstrukt::Plugin::diff - Print out an XHTML table with the difference between two texts
SYNOPSIS
<& diff &>
<$ left $>
1
2
3
<$ / $>
<$ right $>
1
3
<$ / $>
<& / &>
<!-- set another amount of "context" lines -->
<& diff context="2" &>
...
<& / &>
<!-- define a header for the columns -->
<& diff left_header="text a" right_header="text b" &>
...
<& / &>
DESCRIPTION
With this plugin you compare two texts and put out the difference as an XHTML table.
You may also use its Perl interface:
my $diff = use_plugin 'diff';
my $html = $diff->diff("1\n2\n3", "1\n3");
CONFIGURATION
You may configure the default behaviour of the diff plugin:
#context: number of (equal) lines around a diff hunk
diff/context 1048576
METHODS
init
Initialization.
prepare
We can do the work already in the prepare run if there is only static content inside the tag.
Parameters:
$tag - Reference to the tag (and its children) that shall be handled.
execute
Now finally generate the result, if not already done in the prepare run.
Parameters:
$tag - Reference to the tag (and its children) that shall be handled.
process
The real work is done here.
Parameters:
$tag - Reference to the tag (and its children) that shall be handled.
diff
Generates the XHTML-Tables.
Parameters
$left - The left text.
$right - The right text.
$left_header - The left column header. If undef, no header will be displayed.
$right_header - The right column header. If undef, no header will be displayed.
$context - Optional: The number of context lines around a diff hunk
file_header
Generates the header of the whole diff.
Will be called by Text::Diff.
hunk_header
Generates the header of each hunk.
Will be called by Text::Diff.
hunk
Generates the table rows for each hunk.
Will be called by Text::Diff.
hunk_footer
Generates the footer of each hunk.
Will be called by Text::Diff.
file_footer
Generates the footer of the whole diff.
Will be called by Text::Diff.
AUTHOR
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.