Text::WordDiff::HTML(3pm)

Text::WordDiff::HTML3pm

Xhtml formatting for text::worddiff

Usage

    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' };

Overview

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::HTML formats word diffs for viewing in a Web browser. The diff content is highlighted as follows:

•

"<div class="file">"

This element contains the entire contents of the diff "file" returned by "word_diff()". All of the following elements are subsumed by this one.

•

"<span class="fileheader">"

The header section for the files being "diff"ed, usually something like:

  --- in.txt    Thu Sep  1 12:51:03 2005
  +++ out.txt   Thu Sep  1 12:52:12 2005

This element immediately follows the opening "file" "<div>" element, but will not be present if Text::WordDif cannot deterimine the file names for both files being compared.

•

"<span class="hunk">"

This element contains a single diff "hunk". Each hunk may contain the following elements:

•

"<ins>"

Inserted content.

•

"<del>"

Deleted content.

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.

Support

This module is stored in an open repository at the following address:

<https://svn.kineticode.com/Text-WordDiff/trunk/>

Patches against Text::WordDiff are welcome. Please send bug reports to <[email protected]>.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 5 times.

  1. 5.0
  2. 6.0–7
  3. 8
  4. 9
  5. 10–11
  6. 12–13

Author

David Wheeler <[email protected]>

Currently maintained by the developers of The Perl Shop <[email protected]>.

From libtext-worddiff-perl 0.09-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.