1Text::WordDiff::HTML(3)User Contributed Perl DocumentatioTnext::WordDiff::HTML(3)
2
3
4
6 Text::WordDiff::HTML - XHTML formatting for Text::WordDiff
7
9 use Text::WordDiff;
10
11 my $diff = word_diff 'file1.txt', 'file2.txt'; { STYLE => 'HTML' };
12 my $diff = word_diff \$string1, \$string2, { STYLE => 'HTML' };
13 my $diff = word_diff \*FH1, \*FH2, { STYLE => 'HTML' };
14 my $diff = word_diff \&reader1, \&reader2, { STYLE => 'HTML' };
15 my $diff = word_diff \@records1, \@records2, { STYLE => 'HTML' };
16
17 # May also mix input types:
18 my $diff = word_diff \@records1, 'file_B.txt', { STYLE => 'HTML' };
19
21 This class subclasses Text::WordDiff::Base to provide a XHTML
22 formatting for Text::WordDiff. See Term::WordDiff for usage details.
23 This class should never be used directly.
24
25 Text::WordDiff::HTML formats word diffs for viewing in a Web browser.
26 The diff content is highlighted as follows:
27
28 • "<div class="file">"
29
30 This element contains the entire contents of the diff "file"
31 returned by word_diff(). All of the following elements are subsumed
32 by this one.
33
34 • "<span class="fileheader">"
35
36 The header section for the files being "diff"ed, usually
37 something like:
38
39 --- in.txt Thu Sep 1 12:51:03 2005
40 +++ out.txt Thu Sep 1 12:52:12 2005
41
42 This element immediately follows the opening "file" "<div>"
43 element, but will not be present if Text::WordDif cannot
44 deterimine the file names for both files being compared.
45
46 • "<span class="hunk">"
47
48 This element contains a single diff "hunk". Each hunk may
49 contain the following elements:
50
51 • "<ins>"
52
53 Inserted content.
54
55 • "<del>"
56
57 Deleted content.
58
59 You may do whatever you like with these elements and classes; I highly
60 recommend that you style them using CSS. You'll find an example CSS
61 file in the eg directory in the Text-WordDiff distribution.
62
64 Text::WordDiff
65 Text::WordDiff::ANSIColor
66
68 This module is stored in an open repository at the following address:
69
70 <https://svn.kineticode.com/Text-WordDiff/trunk/>
71
72 Patches against Text::WordDiff are welcome. Please send bug reports to
73 <bug-text-worddiff@rt.cpan.org>.
74
76 David Wheeler <david@kineticode.com>
77
78 Currently maintained by the developers of The Perl Shop <tps@cpan.org>.
79
81 Copyright (c) 2005-2011 David E. Wheeler. Some Rights Reserved.
82
83 This module is free software; you can redistribute it and/or modify it
84 under the same terms as Perl itself.
85
86
87
88perl v5.36.0 2023-01-20 Text::WordDiff::HTML(3)