GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::WordDiff::HTMLTwoLines(3) User Contributed Perl Documentation Text::WordDiff::HTMLTwoLines(3)

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

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

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:

"<div class="file">"

The inputs to "word_diff()" are each contained in a div element of class "file". All the following results are subsumed by these elements.

  • "<span class="fileheader">"

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

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

    for the first file, and

      +++ out.txt   Thu Sep  1 12:52:12 2005
        

    for the second.

    This element immediately follows the opening "file" "<div>" element, but will not be present if Text::WordDiff cannot determine 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.

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

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

Currently maintained by the developers of The Perl Shop <tps@cpan.org>.

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.

2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.