Text::...oLines(3pm)
β¨ NAME β¨
Text::WordDiff::HTMLTwoLines β it's giving XHTML formatting for Text::WordDiff, but with the content on two lines π«Ά (this is the 3pm perl manpage, the user-contributed Perl documentation vibe, bestie)
πΈ 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 π
So this class subclasses Text::WordDiff::Base to provide a XHTML formatting for Text::WordDiff. Wanna know how to actually use it? Go read Term::WordDiff, that's where the usage details live, iykyk. And listen β this class should never be used directly, okay? Not me being dramatic, that's literally the rule. π
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. And HTMLTwoLines puts a span tag around each word or set of words in the diff. Obsessed, honestly. β¨
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 diffed, 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. Slay. π
π¦ SEE ALSO π¦
Text::WordDiffText::WordDiff::ANSIColorText::WordDiff::ANSIColor
(no bestie, that's not a typo on my end, it's listed twice, I don't make the rules π)
π AUTHOR π
Amelia Ireland <join(".", $firstname, $lastname) . "@gmail.com">
Currently maintained by the developers of The Perl Shop <tps@cpan.org>. π«Ά
π 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.
okay that's the whole thing, no cap π
perl v5.36.0 Β· 2022-12-12 β that's the version and date this page came from, mwah, bye bestie πΈβ¨π¦
π¦ 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