See Release Notes
Long Term Support Release
Standard diff function plus some extras for handling XHTML diffs.
Author: | s.marshall@open.ac.uk |
Copyright: | © 2007 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU Public License |
File Size: | 765 lines (24 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ouwiki_line:: (2 methods):
__construct()
ouwiki_line()
name:: (10 methods):
get_as_string()
get_as_strings()
is_empty()
ouwiki_diff_html_to_lines()
internal_find_deletes()
ouwiki_diff_internal_flip()
ouwiki_diff_words()
ouwiki_diff()
ouwiki_diff_add_markers()
ouwiki_diff_html()
ouwiki_word:: (2 methods):
__construct()
ouwiki_word()
name:: (10 methods):
get_as_string()
get_as_strings()
is_empty()
ouwiki_diff_html_to_lines()
internal_find_deletes()
ouwiki_diff_internal_flip()
ouwiki_diff_words()
ouwiki_diff()
ouwiki_diff_add_markers()
ouwiki_diff_html()
ouwiki_change_range:: (0 methods):
ouwiki_changes:: (2 methods):
__construct()
ouwiki_changes()
name:: (10 methods):
get_as_string()
get_as_strings()
is_empty()
ouwiki_diff_html_to_lines()
internal_find_deletes()
ouwiki_diff_internal_flip()
ouwiki_diff_words()
ouwiki_diff()
ouwiki_diff_add_markers()
ouwiki_diff_html()
Class: ouwiki_line - X-Ref
Class representing one 'line' of HTML content for the purpose of__construct($data,$linepos) X-Ref |
Construct line object based on a chunk of text. param: string $data Text data that makes up this 'line'. (May include line breaks etc.) param: int $linepos Position number for first character in text |
ouwiki_line($data, $linepos) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_as_string() X-Ref |
return: string Normalised string representation of this line object |
get_as_strings($lines) X-Ref |
Static function converts lines to strings. param: array $lines Array of ouwiki_line return: array Array of strings |
is_empty() X-Ref |
return: True if there are no words in the line |
ouwiki_diff_html_to_lines($content) X-Ref |
Prepares XHTML content for text difference comparison. param: string $content XHTML content [NO SLASHES] return: array Array of ouwiki_line objects |
internal_find_deletes($diff,$count2) X-Ref |
Find deleted lines. These are lines in file1 that cannot be present even in modified form in file2 because we have matching lines around them. O(n) algorithm. param: array $diff Array of file1->file2 indexes param: int $count2 Count of lines in file2 |
ouwiki_diff_internal_flip($diff,$count2) X-Ref |
Flips around the array returned by ouwiki_diff_internal so that it refers to lines from the other file. param: array $diff Array of index1=>index2 param: int $count2 Count of lines in file 2 return: array Flipped version |
ouwiki_diff_words($lines1,$lines2) X-Ref |
Compares two files based initially on lines and then on words within the lines that differ. param: array $lines1 Array of ouwiki_line param: array $lines2 Array of ouwiki_line return: array (deleted,added); deleted and added are arrays of ouwiki_word with |
ouwiki_diff($file1,$file2) X-Ref |
Runs diff and interprets results into ouwiki_changes object. param: array $file1 Array of lines in file 1. The first line in the file param: array $file2 Array of lines in file 2, again starting from 1. return: ouwiki_changes Object describing changes |
ouwiki_diff_add_markers($html,$words,$markerclass,$beforetext,$aftertext) X-Ref |
Adds HTML span elements to $html around the words listed in $words. param: string $html HTML content param: array $words Array of ouwiki_word to mark param: string $markerclass Name of class for span element return: HTML with markup added |
ouwiki_diff_html($html1,$html2) X-Ref |
Compares two HTML files. (This is the main function that everything else supports.) param: string $html1 XHTML for file 1 param: string $html2 XHTML for file 2 return: array ($result1,$result2) to be displayed indicating the differences |
Class: ouwiki_word - X-Ref
Represents single word for html comparison. Note that words__construct($word,$start) X-Ref |
No description |
ouwiki_word($word, $start) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_as_string() X-Ref |
return: string Normalised string representation of this line object |
get_as_strings($lines) X-Ref |
Static function converts lines to strings. param: array $lines Array of ouwiki_line return: array Array of strings |
is_empty() X-Ref |
return: True if there are no words in the line |
ouwiki_diff_html_to_lines($content) X-Ref |
Prepares XHTML content for text difference comparison. param: string $content XHTML content [NO SLASHES] return: array Array of ouwiki_line objects |
internal_find_deletes($diff,$count2) X-Ref |
Find deleted lines. These are lines in file1 that cannot be present even in modified form in file2 because we have matching lines around them. O(n) algorithm. param: array $diff Array of file1->file2 indexes param: int $count2 Count of lines in file2 |
ouwiki_diff_internal_flip($diff,$count2) X-Ref |
Flips around the array returned by ouwiki_diff_internal so that it refers to lines from the other file. param: array $diff Array of index1=>index2 param: int $count2 Count of lines in file 2 return: array Flipped version |
ouwiki_diff_words($lines1,$lines2) X-Ref |
Compares two files based initially on lines and then on words within the lines that differ. param: array $lines1 Array of ouwiki_line param: array $lines2 Array of ouwiki_line return: array (deleted,added); deleted and added are arrays of ouwiki_word with |
ouwiki_diff($file1,$file2) X-Ref |
Runs diff and interprets results into ouwiki_changes object. param: array $file1 Array of lines in file 1. The first line in the file param: array $file2 Array of lines in file 2, again starting from 1. return: ouwiki_changes Object describing changes |
ouwiki_diff_add_markers($html,$words,$markerclass,$beforetext,$aftertext) X-Ref |
Adds HTML span elements to $html around the words listed in $words. param: string $html HTML content param: array $words Array of ouwiki_word to mark param: string $markerclass Name of class for span element return: HTML with markup added |
ouwiki_diff_html($html1,$html2) X-Ref |
Compares two HTML files. (This is the main function that everything else supports.) param: string $html1 XHTML for file 1 param: string $html2 XHTML for file 2 return: array ($result1,$result2) to be displayed indicating the differences |
Class: ouwiki_change_range - X-Ref
Represents a changed area of file and where it is located in theClass: ouwiki_changes - X-Ref
A more logical representation of the results from ouwiki_internal_diff()__construct($diff,$count2) X-Ref |
param: array $diff Array from line indices in file1 param: int $count2 Number of lines in file2 |
ouwiki_changes($diff, $count2) X-Ref |
Old syntax of class constructor. Deprecated in PHP7. |
get_as_string() X-Ref |
return: string Normalised string representation of this line object |
get_as_strings($lines) X-Ref |
Static function converts lines to strings. param: array $lines Array of ouwiki_line return: array Array of strings |
is_empty() X-Ref |
return: True if there are no words in the line |
ouwiki_diff_html_to_lines($content) X-Ref |
Prepares XHTML content for text difference comparison. param: string $content XHTML content [NO SLASHES] return: array Array of ouwiki_line objects |
internal_find_deletes($diff,$count2) X-Ref |
Find deleted lines. These are lines in file1 that cannot be present even in modified form in file2 because we have matching lines around them. O(n) algorithm. param: array $diff Array of file1->file2 indexes param: int $count2 Count of lines in file2 |
ouwiki_diff_internal_flip($diff,$count2) X-Ref |
Flips around the array returned by ouwiki_diff_internal so that it refers to lines from the other file. param: array $diff Array of index1=>index2 param: int $count2 Count of lines in file 2 return: array Flipped version |
ouwiki_diff_words($lines1,$lines2) X-Ref |
Compares two files based initially on lines and then on words within the lines that differ. param: array $lines1 Array of ouwiki_line param: array $lines2 Array of ouwiki_line return: array (deleted,added); deleted and added are arrays of ouwiki_word with |
ouwiki_diff($file1,$file2) X-Ref |
Runs diff and interprets results into ouwiki_changes object. param: array $file1 Array of lines in file 1. The first line in the file param: array $file2 Array of lines in file 2, again starting from 1. return: ouwiki_changes Object describing changes |
ouwiki_diff_add_markers($html,$words,$markerclass,$beforetext,$aftertext) X-Ref |
Adds HTML span elements to $html around the words listed in $words. param: string $html HTML content param: array $words Array of ouwiki_word to mark param: string $markerclass Name of class for span element return: HTML with markup added |
ouwiki_diff_html($html1,$html2) X-Ref |
Compares two HTML files. (This is the main function that everything else supports.) param: string $html1 XHTML for file 1 param: string $html2 XHTML for file 2 return: array ($result1,$result2) to be displayed indicating the differences |
ouwiki_diff_internal($file1,$file2) X-Ref |
Basic diff utility function, using standard diff algorithm. Based on Bell Laboratories Computing Science Technical Report #41, July 1976, Hunt & McIlroy, Appendix A.1 and A.3. http://www.cs.dartmouth.edu/~doug/diff.ps param: array $file1 Array of lines in file 1. The first line in the file param: array $file2 Array of lines in file 2, again starting from 1. return: array An array with one entry (again 1-based) for each line in |
ouwiki_diff_merge(&$K,&$k,$i,&$E,$p,&$candidates) X-Ref |
No description |
ouwiki_diff_sort_v($a,$b) X-Ref |
No description |
ouwiki_diff_find_last(&$V,&$E,$hash) X-Ref |
No description |