Konstrukt::Plugin::diff - Print out an XHTML table with the difference between two texts
Usage:
<& diff &> <$ left $> 1 2 3 <$ / $> <$ right $> 1 3 <$ / $> <& / &>
or
<!-- set another amount of "context" lines --> <& diff context="2" &> ... <& / &>
<!-- define a header for the columns --> <& diff left_header="text a" right_header="text b" &> ... <& / &>
Result:
A table showing the difference between the two texts.
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");
You may configure the default behaviour of the diff plugin:
#context: number of (equal) lines around a diff hunk diff/context 1048576
Initialization.
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.
Now finally generate the result, if not already done in the prepare run.
The real work is done here.
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
Generates the header of the whole diff.
Will be called by Text::Diff.
Generates the header of each hunk.
Generates the table rows for each hunk.
Generates the footer of each hunk.
Generates the footer of the whole diff.
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.
Konstrukt::Plugin, Konstrukt
To install Konstrukt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Konstrukt
CPAN shell
perl -MCPAN -e shell install Konstrukt
For more information on module installation, please visit the detailed CPAN module installation guide.