Text::...::HTML(3pm)
okay so bestie, you found the Text::...::HTML(3pm) page β that's the User Contributed Perl Documentation version of a Perl module manpage, section 3pm, and it's all about pretty-printing word diffs for the web. Buckle up, it's a short one but it's cute. π
β¨ NAME β¨
Text::WordDiff::HTML β XHTML formatting for Text::WordDiff π
πΈ 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' };
like yes, you can feed it filenames, scalar refs, glob refs, code refs, array refs β and you can even mix them up, no cap. π
π DESCRIPTION π
So this class subclasses Text::WordDiff::Base to provide a XHTML formatting for Text::WordDiff. Want the usage deets? Go peek at Term::WordDiff. π¦
real talk though: this class should never be used directly. It's giving backstage-pass-only. π
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. π
π SEE ALSO π
Text::WordDiffText::WordDiff::ANSIColor
π«Ά 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 <bug-text-worddiff@rt.cpan.org>. fr fr, they want your patches, don't be shy. π
π AUTHOR π
David Wheeler <david@kineticode.com>
Currently maintained by the developers of The Perl Shop <tps@cpan.org>. π
π COPYRIGHT AND LICENSE π
Copyright (c) 2005-2011 David E. Wheeler. Some Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, it's free, go wild (within the license, obviously). π
and that's the whole vibe check, bestie β this page came from perl v5.36.0 and it's dated 2022-12-12, so go forth and diff some words in style. π¦β¨
π¦ where this page comes from
- debian bookworm: libtext-worddiff-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-worddiff-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-worddiff-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-worddiff-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-worddiff-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms