David E. Wheeler > Text-WordDiff-0.08 > Text::WordDiff::HTMLTwoLines

Download:
Text-WordDiff-0.08.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.08   Source  

Name ^

Text::WordDiff::HTMLTwoLines - XHTML formatting for Text::WordDiff with content on two lines

Synopsis ^

    use Text::WordDiff;

    my $diff = word_diff 'file1.txt', 'file2.txt';  { STYLE => 'HTMLTwoLines' };
    my $diff = word_diff \$string1,   \$string2,    { STYLE => 'HTMLTwoLines' };
    my $diff = word_diff \*FH1,       \*FH2,        { STYLE => 'HTMLTwoLines' };
    my $diff = word_diff \&reader1,   \&reader2,    { STYLE => 'HTMLTwoLines' };
    my $diff = word_diff \@records1,  \@records2,   { STYLE => 'HTMLTwoLines' };

    # May also mix input types:
    my $diff = word_diff \@records1,  'file_B.txt', { STYLE => 'HTMLTwoLines' };

Description ^

This class subclasses Text::WordDiff::Base to provide a XHTML formatting for Text::WordDiff. See Term::WordDiff for usage details. This class should never be used directly.

Text::WordDiff::HTMLTwoLines formats word diffs for viewing in a Web browser. The output is similar to that produced by Term::WordDiff::HTML but the two lines (or files, records, etc.) are shown separately, with deleted items highlighted in the first line and inserted items highlighted in the second. HTMLTwoLines puts a span tag around each word or set of words in the diff.

The diff content is highlighted as follows:

You may do whatever you like with these elements and classes; I highly recommend that you style them using CSS. You'll find an example CSS file in the eg directory in the Text-WordDiff distribution.

See Also ^

Text::WordDiff
Text::WordDiff::ANSIColor
Text::WordDiff::ANSIColor

Author ^

Amelia Ireland <join(".", $firstname, $lastname) . "@gmail.com">

Copyright and License ^

Copyright (c) 2011 Amelia Ireland. Some Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: