package Text::WordDiff::HTML;
use strict;
use HTML::Entities qw(encode_entities);
use vars qw($VERSION @ISA);
$VERSION = '0.04';
@ISA = qw(Text::WordDiff::Base);
sub file_header {
my $header = shift->SUPER::file_header(@_);
return '
' unless $header;
return qq{
};
}
sub hunk_header { return '' }
sub hunk_footer { return '' }
sub file_footer { return '
' }
sub same_items {
shift;
return encode_entities( join '', @_ );
}
sub delete_items {
shift;
return '
' . encode_entities( join'', @_ ) . '';
}
sub insert_items {
shift;
return '
' . encode_entities( join'', @_ ) . '';
}
1;
__END__
=begin comment
Fake-out Module::Build. Delete if it ever changes to support =head1 headers
other than all uppercase.
=head1 NAME
Text::WordDiff::HTML - XHTML formatting for Text::WordDiff
=end comment
=head1 Name
Text::WordDiff::HTML - XHTML formatting for Text::WordDiff
=head1 Synopsis
use Text::WordDiff;
my $diff = word_diff 'file1.txt', 'file2.txt'; { STYLE => 'HTML' };
my $diff = word_diff \$string1, \$string2, { STYLE => 'HTML' };
my $diff = word_diff \*FH1, \*FH2, { STYLE => 'HTML' };
my $diff = word_diff \&reader1, \&reader2, { STYLE => 'HTML' };
my $diff = word_diff \@records1, \@records2, { STYLE => 'HTML' };
# May also mix input types:
my $diff = word_diff \@records1, 'file_B.txt', { STYLE => 'HTML' };
=head1 Description
This class subclasses Text::WordDiff::Base to provide a XHTML formatting for
Text::WordDiff. See L
for usage details. This
class should never be used directly.
Text::WordDiff::HTML formats word diffs for viewing in a Web browser. The diff
content is highlighted as follows:
=over
=item * C<< >>
This element contains the entire contents of the diff "file" returned by
C. All of the following elements are subsumed by this one.
=over
=item * C<<