.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::Diff 3pm" .TH HTML::Diff 3pm "2022-06-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::Diff \- compare two HTML strings and return a list of differences .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use HTML::Diff; \& \& $result = html_word_diff($left_text, $right_text); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module compares two strings of \s-1HTML\s0 and returns a list of a chunks which indicate the diff between the two input strings, where changes in formatting are considered changes. .PP HTML::Diff does not strictly parse the \s-1HTML.\s0 Instead, it uses regular expressions to make a decent effort at understanding the given \s-1HTML.\s0 As a result, there are many valid \s-1HTML\s0 documents for which it will not produce the correct answer. But there may be some invalid \s-1HTML\s0 documents for which it gives you the answer you're looking for. Your mileage may vary; test it on lots of inputs from your domain before relying on it. .PP Returns a reference to a list of triples [, , ]. Each triple represents a check of the input texts. The flag tells you whether it represents a deletion, insertion, a modification, or an unchanged chunk. .PP Every character of each input text is accounted for by some triple in the output. Specifically, Concatenating all the members from the return value should produce \f(CW$left_text\fR, and likewise the members concatenate together to produce \f(CW$right_text\fR. .PP The is either \f(CW\*(Aqu\*(Aq\fR, \f(CW\*(Aq+\*(Aq\fR, \f(CW\*(Aq\-\*(Aq\fR, or \f(CW\*(Aqc\*(Aq\fR, indicating whether the two chunks are the same, the \f(CW$right_text\fR contained this chunk and the left chunk didn't, or vice versa, or the two chunks are simply different. This follows the usage of Algorithm::Diff. .PP The difference is computed on a word-by-word basis, \*(L"breaking\*(R" on visible words in the \s-1HTML\s0 text. If a tag only is changed, it will not be returned as an independent chunk but will be shown as a change to one of the neighboring words. For balanced tags, such as , it is intended that a change to the tag will be treated as a change to all words in between. .SH "SEE ALSO" .IX Header "SEE ALSO" Algorithm::Diff provides the diff algorithm used in this module. .PP XML::Diff can generate a diff between two \s-1XML\s0 files, and also patch an \s-1XML\s0 file, given a diff. .SH "REPOSITORY" .IX Header "REPOSITORY" .SH "AUTHOR" .IX Header "AUTHOR" Whipped up by Ezra elias kilty Cooper, . .PP Patch contributed by Adam . .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2003\-2014 by Ezra elias kilty Cooper, .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.