diff-8.06.15/0000755000175000017500000000000011025410256011341 5ustar yuriyuridiff-8.06.15/lua/0000755000175000017500000000000011025407756012135 5ustar yuriyuridiff-8.06.15/lua/diff.lua0000644000175000017500000001604011025407756013551 0ustar yuriyuri----------------------------------------------------------------------------- -- Provides functions for diffing text. -- -- (c) 2007, 2008 Yuri Takhteyev (yuri@freewisdom.org) -- (c) 2007 Hisham Muhammad -- -- License: MIT/X, see http://sputnik.freewisdom.org/en/License ----------------------------------------------------------------------------- module(..., package.seeall) SKIP_SEPARATOR = true -- a constant IN = "in"; OUT = "out"; SAME = "same" -- token statuses ----------------------------------------------------------------------------- -- Split a string into tokens. (Adapted from Gavin Kistner's split on -- http://lua-users.org/wiki/SplitJoin. -- -- @param text A string to be split. -- @param separator [optional] the separator pattern (defaults to any -- white space - %s+). -- @param skip_separator [optional] don't include the sepator in the results. -- @return A list of tokens. ----------------------------------------------------------------------------- function split(text, separator, skip_separator) separator = separator or "%s+" local parts = {} local start = 1 local split_start, split_end = text:find(separator, start) while split_start do table.insert(parts, text:sub(start, split_start-1)) if not skip_separator then table.insert(parts, text:sub(split_start, split_end)) end start = split_end + 1 split_start, split_end = text:find(separator, start) end if text:sub(start)~="" then table.insert(parts, text:sub(start) ) end return parts end ----------------------------------------------------------------------------- -- Derives the longest common subsequence of two strings. This is a faster -- implementation than one provided by stdlib. Submitted by Hisham Muhammad. -- The algorithm was taken from: -- http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_subsequence -- -- @param t1 the first string. -- @param t2 the second string. -- @return the least common subsequence as a matrix. ----------------------------------------------------------------------------- function quick_LCS(t1, t2) local m = #t1 local n = #t2 -- Build matrix on demand local C = {} local setmetatable = setmetatable local mt_tbl = { __index = function(t, k) t[k] = 0 return 0 end } local mt_C = { __index = function(t, k) local tbl = {} setmetatable(tbl, mt_tbl) t[k] = tbl return tbl end } setmetatable(C, mt_C) local max = math.max for i = 1, m+1 do local ci1 = C[i+1] local ci = C[i] for j = 1, n+1 do if t1[i-1] == t2[j-1] then ci1[j+1] = ci[j] + 1 else ci1[j+1] = max(ci1[j], ci[j+1]) end end end return C end ----------------------------------------------------------------------------- -- Escapes an HTML string. -- -- @param text The string to be escaped. -- @return Escaped string. ----------------------------------------------------------------------------- function escape_html(text) text = text:gsub("&", "&"):gsub(">",">"):gsub("<","<") text = text:gsub("\"", """) return text end ----------------------------------------------------------------------------- -- Formats an inline diff as HTML, with and tags. -- -- @param tokens a table of {token, status} pairs. -- @return an HTML string. ----------------------------------------------------------------------------- function format_as_html(tokens) local diff_buffer = "" local token, status for i, token_record in ipairs(tokens) do token = escape_html(token_record[1]) status = token_record[2] if status == "in" then diff_buffer = diff_buffer..""..token.."" elseif status == "out" then diff_buffer = diff_buffer..""..token.."" else diff_buffer = diff_buffer..token end end return diff_buffer end ----------------------------------------------------------------------------- -- Returns a diff of two strings as a list of pairs, where the first value -- represents a token and the second the token's status ("same", "in", "out"). -- -- @param old The "old" text string -- @param new The "new" text string -- @param separator [optional] the separator pattern (defaults ot any -- white space). -- @return A list of annotated tokens. ----------------------------------------------------------------------------- function diff(old, new, separator) assert(old); assert(new) new = split(new, separator); old = split(old, separator) -- First, compare the beginnings and ends of strings to remove the common -- prefix and suffix. Chances are, there is only a small number of tokens -- in the middle that differ, in which case we can save ourselves a lot -- in terms of LCS computation. local prefix = "" -- common text in the beginning local suffix = "" -- common text in the end while old[1] and old[1] == new[1] do local token = table.remove(old, 1) table.remove(new, 1) prefix = prefix..token end while old[#old] and old[#old] == new[#new] do local token = table.remove(old) table.remove(new) suffix = token..suffix end -- Setup a table that will store the diff (an upvalue for get_diff). We'll -- store it in the reverse order to allow for tail calls. We'll also keep -- in this table functions to handle different events. local rev_diff = { put = function(self, token, type) table.insert(self, {token,type}) end, ins = function(self, token) self:put(token, IN) end, del = function(self, token) self:put(token, OUT) end, same = function(self, token) if token then self:put(token, SAME) end end, } -- Put the suffix as the first token (we are storing the diff in the -- reverse order) rev_diff:same(suffix) -- Define a function that will scan the LCS matrix backwards and build the -- diff output recursively. local function get_diff(C, old, new, i, j) local old_i = old[i] local new_j = new[j] if i >= 1 and j >= 1 and old_i == new_j then rev_diff:same(old_i) return get_diff(C, old, new, i-1, j-1) else local Cij1 = C[i][j-1] local Ci1j = C[i-1][j] if j >= 1 and (i == 0 or Cij1 >= Ci1j) then rev_diff:ins(new_j) return get_diff(C, old, new, i, j-1) elseif i >= 1 and (j == 0 or Cij1 < Ci1j) then rev_diff:del(old_i) return get_diff(C, old, new, i-1, j) end end end -- Then call it. get_diff(quick_LCS(old, new), old, new, #old + 1, #new + 1) -- Put the prefix in at the end rev_diff:same(prefix) -- Reverse the diff. local diff = {} for i = #rev_diff, 1, -1 do table.insert(diff, rev_diff[i]) end diff.to_html = format_as_html return diff end diff-8.06.15/lua/luadoc.log0000644000175000017500000000023511025407756014107 0ustar yuriyuriMon Jun 16 00:02:06 2008 INFO processing file `diff.lua' Mon Jun 16 00:02:06 2008 DEBUG found module `...' Mon Jun 16 00:02:06 2008 DEBUG found module `...' diff-8.06.15/diff/0000755000175000017500000000000011025410256012251 5ustar yuriyuridiff-8.06.15/diff/lua/0000755000175000017500000000000011025410256013032 5ustar yuriyuridiff-8.06.15/diff/lua/diff.lua0000644000175000017500000001604011025410745014451 0ustar yuriyuri----------------------------------------------------------------------------- -- Provides functions for diffing text. -- -- (c) 2007, 2008 Yuri Takhteyev (yuri@freewisdom.org) -- (c) 2007 Hisham Muhammad -- -- License: MIT/X, see http://sputnik.freewisdom.org/en/License ----------------------------------------------------------------------------- module(..., package.seeall) SKIP_SEPARATOR = true -- a constant IN = "in"; OUT = "out"; SAME = "same" -- token statuses ----------------------------------------------------------------------------- -- Split a string into tokens. (Adapted from Gavin Kistner's split on -- http://lua-users.org/wiki/SplitJoin. -- -- @param text A string to be split. -- @param separator [optional] the separator pattern (defaults to any -- white space - %s+). -- @param skip_separator [optional] don't include the sepator in the results. -- @return A list of tokens. ----------------------------------------------------------------------------- function split(text, separator, skip_separator) separator = separator or "%s+" local parts = {} local start = 1 local split_start, split_end = text:find(separator, start) while split_start do table.insert(parts, text:sub(start, split_start-1)) if not skip_separator then table.insert(parts, text:sub(split_start, split_end)) end start = split_end + 1 split_start, split_end = text:find(separator, start) end if text:sub(start)~="" then table.insert(parts, text:sub(start) ) end return parts end ----------------------------------------------------------------------------- -- Derives the longest common subsequence of two strings. This is a faster -- implementation than one provided by stdlib. Submitted by Hisham Muhammad. -- The algorithm was taken from: -- http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_subsequence -- -- @param t1 the first string. -- @param t2 the second string. -- @return the least common subsequence as a matrix. ----------------------------------------------------------------------------- function quick_LCS(t1, t2) local m = #t1 local n = #t2 -- Build matrix on demand local C = {} local setmetatable = setmetatable local mt_tbl = { __index = function(t, k) t[k] = 0 return 0 end } local mt_C = { __index = function(t, k) local tbl = {} setmetatable(tbl, mt_tbl) t[k] = tbl return tbl end } setmetatable(C, mt_C) local max = math.max for i = 1, m+1 do local ci1 = C[i+1] local ci = C[i] for j = 1, n+1 do if t1[i-1] == t2[j-1] then ci1[j+1] = ci[j] + 1 else ci1[j+1] = max(ci1[j], ci[j+1]) end end end return C end ----------------------------------------------------------------------------- -- Escapes an HTML string. -- -- @param text The string to be escaped. -- @return Escaped string. ----------------------------------------------------------------------------- function escape_html(text) text = text:gsub("&", "&"):gsub(">",">"):gsub("<","<") text = text:gsub("\"", """) return text end ----------------------------------------------------------------------------- -- Formats an inline diff as HTML, with and tags. -- -- @param tokens a table of {token, status} pairs. -- @return an HTML string. ----------------------------------------------------------------------------- function format_as_html(tokens) local diff_buffer = "" local token, status for i, token_record in ipairs(tokens) do token = escape_html(token_record[1]) status = token_record[2] if status == "in" then diff_buffer = diff_buffer..""..token.."" elseif status == "out" then diff_buffer = diff_buffer..""..token.."" else diff_buffer = diff_buffer..token end end return diff_buffer end ----------------------------------------------------------------------------- -- Returns a diff of two strings as a list of pairs, where the first value -- represents a token and the second the token's status ("same", "in", "out"). -- -- @param old The "old" text string -- @param new The "new" text string -- @param separator [optional] the separator pattern (defaults ot any -- white space). -- @return A list of annotated tokens. ----------------------------------------------------------------------------- function diff(old, new, separator) assert(old); assert(new) new = split(new, separator); old = split(old, separator) -- First, compare the beginnings and ends of strings to remove the common -- prefix and suffix. Chances are, there is only a small number of tokens -- in the middle that differ, in which case we can save ourselves a lot -- in terms of LCS computation. local prefix = "" -- common text in the beginning local suffix = "" -- common text in the end while old[1] and old[1] == new[1] do local token = table.remove(old, 1) table.remove(new, 1) prefix = prefix..token end while old[#old] and old[#old] == new[#new] do local token = table.remove(old) table.remove(new) suffix = token..suffix end -- Setup a table that will store the diff (an upvalue for get_diff). We'll -- store it in the reverse order to allow for tail calls. We'll also keep -- in this table functions to handle different events. local rev_diff = { put = function(self, token, type) table.insert(self, {token,type}) end, ins = function(self, token) self:put(token, IN) end, del = function(self, token) self:put(token, OUT) end, same = function(self, token) if token then self:put(token, SAME) end end, } -- Put the suffix as the first token (we are storing the diff in the -- reverse order) rev_diff:same(suffix) -- Define a function that will scan the LCS matrix backwards and build the -- diff output recursively. local function get_diff(C, old, new, i, j) local old_i = old[i] local new_j = new[j] if i >= 1 and j >= 1 and old_i == new_j then rev_diff:same(old_i) return get_diff(C, old, new, i-1, j-1) else local Cij1 = C[i][j-1] local Ci1j = C[i-1][j] if j >= 1 and (i == 0 or Cij1 >= Ci1j) then rev_diff:ins(new_j) return get_diff(C, old, new, i, j-1) elseif i >= 1 and (j == 0 or Cij1 < Ci1j) then rev_diff:del(old_i) return get_diff(C, old, new, i-1, j) end end end -- Then call it. get_diff(quick_LCS(old, new), old, new, #old + 1, #new + 1) -- Put the prefix in at the end rev_diff:same(prefix) -- Reverse the diff. local diff = {} for i = #rev_diff, 1, -1 do table.insert(diff, rev_diff[i]) end diff.to_html = format_as_html return diff end diff-8.06.15/diff/lua/luadoc.log0000644000175000017500000000023511025410745015007 0ustar yuriyuriMon Jun 16 00:10:29 2008 INFO processing file `diff.lua' Mon Jun 16 00:10:29 2008 DEBUG found module `...' Mon Jun 16 00:10:29 2008 DEBUG found module `...' diff-8.06.15/diff/doc/0000755000175000017500000000000011025410473013017 5ustar yuriyuridiff-8.06.15/diff/doc/diff.xcf0000644000175000017500000004552211025410745014443 0ustar yuriyurigimp xcf fileBBaS gimp-commentCreated with The GIMPgimp-image-grid(style intersections) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) $#FHeJ< New Layer#1     [z$ $; q!";"K#}#u 3 2 u 3 2 u \3 \2 \u&z25S1 rN 3 2 )N 3 2 )N \3 \2 \)N&z25S1 r(:95)"                                S:95)"                                S\:\9\5\)\"\\\\ \\\ \\\ \\\ \\ \ \\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\ \\ \\\\\\\\\\\\\\\\\\\\ \\ \\ \\\\ \\\ \S:DL8 j4FzIJlP0 (@߬q*!-v?n6 Xz&^ yL ] ]N Q4i Hq  =Z( WN~  _ 2w ROD F"    LP 7 V4 }dGS07 / \ AL }  Kf;2 r)2MMCxM~9a6yS p) P} ?WK꜔|tlc[UUW^lfmVuׂ'| ©Z R/    ""          )+                            !   /    ""          )+                            !   / \\ \\\\\\\\\\\ \\ \\\\\\\\\\\\"\\"\\ \\ \\ \\ \\ \\\ \\\\\\\\\ \\\ \\\ \ \)\\\\+\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\ \\\ \\\ \\\ \\\ \\\ \\\\\\\\ \\\\ \\\\ \\\ \\\ \ \\ \ \\ \ \\ \ \\ \\\\\ \\ \\ \\ \\ \\ \\ \\ \\!\\ \\ \\ /-O?(Ltwiyt~<ZpIZ p-|D"ME, 9.!Qe!j<<I  zx   G~G]u;*< 4CC V-$Mbob 8 (1,,cmHmH[  &&.^`<`gE*( t6kD0D t{{74 ggw!$!$ZZ`T':K=]]zb-<  1D|@@0zz}BB ) k 33  sGsG F%A)A)PP--]]SESE ``&$&$2626 1 19999888878889999::::; 1 2 4<<<<======= 1 19999888878889999::::; 1 2 4<<<<======= \1 \1\9\9\9\9\8\8\8\8\7\8\8\8\9\9\9\9\:\:\:\:\; \1 \2 \4\<\<\<\<\=\=\=\=\=\=\=\-0O?(Lt0i8y8~<8p8IZ7 77"M7 67Qe7788I8 89~9;99:0 1o3;;H; ;<<<<<=t=0=& 9:8j|:p/|?t9-9ާ9ZayZX@Ui1#GY|j (Ȉ@M0s@,lMc'.V * evcaS`+ <BO:`[Fs? H{" !k  !^0 q Uo>S=u(Qg A)39k&RA ZJ6ZPE$nGH>> >F2 F2   [޷{! [޷{!@@@y :S 3y ;A;M:):r>819 'z'''niN4' New LayerG     $$FzF%!(h,!4p49=DDErEFje$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#we$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#we$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@ ݻww+wDDw#݈33DD" "ww$w"("U,U . w1 f233343)Uw33(f"D'w'3''D'D('"w(w)f)++@ ݻww+wDDw#݈33DD" "ww$w"("U,U . w1 f233343)Uw33(f"D'w'3''D'D('"w(w)f)++@ Ļ+ջ#ę̢đ $ݑ(, ݈. 1 234)ܺ(Ԑ'''''('())++@ @$$$$$$$$$$$ Uf  " 3 f"33UfwUw"wfwDwwww3fw"wDfw3fUf w 3DD 3wD"D 3 3fD w wDDffDDfDf@$$$$$$$$$$$ Uf  " 3 f"33UfwUw"wfwDwwww3fw"wDfw3fUf w 3DD 3wD"D 3 3fD w wDDffDDfDf@$$$$$$$$$$$ ̪  Ĉ    ݢ 滢   @$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#$f$%%w%3%&&&w&U&D&D&"&(((D&D&D&f&w&&&%U%%%"$w$$3##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#$f$%%w%3%&&&w&U&D&D&"&(((D&D&D&f&w&&&%U%%%"$w$$3##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#######$$$$$$$$$$$$$$$$$$#########$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$++w+3,,U--.3 /" 0D1f݈D"==<<D;;w:39887w6f5w4 3 1 30 f.f "*"w(wf$fwwUD݈UU&̈wDDw0++w+3,,U--.3 /" 0D1f݈D"==<<D;;w:39887w6f5w4 3 1 30 f.f "*"w(wf$fwwUD݈UU&̈wDDw0+++,,--. / 0ܡ1á==<<;;:9887654 3 ̈1 0 . ݑ*($̪Ī&Ļ0DUf  U w 3 ++w+D+D+D+,,,+"+D+D+U+w+++*D**)")w)(3('"'&&%D%$w#3""! wff 3!"$$$$$$$$$$$$DUf  U w 3 ++w+D+D+D+,,,+"+D+D+U+w+++*D**)")w)(3('"'&&%D%$w#3""! wff 3!"$$$$$$$$$$$$               !"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$''''iN4'White2     G5GQHMHYGGGGGGGGH HH-H=@@@@@@@@@@@@''''iN4' Background     I I(J$J0IdItIIIIIIIIJJ@@@@@@@@@@@@''''iN4'Selection Mask JJK:KFK KKKKKK"K&K*K.K2K6@@@'iN4'diff-8.06.15/diff/doc/howto.md0000644000175000017500000000140711025410745014505 0ustar yuriyuri A simple diff of two strings: > require("diff") > for _, token in ipairs(diff.diff("This is a test", "This was a test!")) do >> print(token[1], token[2]) >> end This same is out was in same a same same test out test! in same That is, diff.diff(old, new) returns a table of pairs, each consisting of a string and it's status: "same" (the string is present in both), "in" (the string appeared in new, or "out" (the string was present in old but was removed). Alternatively, you can just generate an HTML for this diff: > = diff.diff("This is a test", "This was a test!"):to_html() This iswas a testtest! diff-8.06.15/diff/doc/index.html0000644000175000017500000001744011025410745015024 0ustar yuriyuri Diff

Overview

This module provides a small collection of functions for diffing text.

Installation

The Diff library consists of a single file (diff.lua), plus a test script (tests/basic.lua). Just put the file somewhere in your Lua path. Here is a list of recent releases:

You can also install it using LuaRocks with

luarocks install diff

or:

luarocks --from=http://sputnik.freewisdom.org/rocks/earth install diff

Using Diff

A simple diff of two strings:

> require("diff")
> for _, token in ipairs(diff.diff("This is a test", "This was a test!")) do 
>> print(token[1], token[2])
>> end
This    same
is      out
was     in
        same
a       same
        same
test    out
test!   in
        same

That is, diff.diff(old, new) returns a table of pairs, each consisting of a string and it's status: "same" (the string is present in both), "in" (the string appeared in new, or "out" (the string was present in old but was removed).

Alternatively, you can just generate an HTML for this diff:

> = diff.diff("This is a test", "This was a test!"):to_html()
This <del>is</del><ins>was</ins> a <del>test</del><ins>test!</ins>

Contact

Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions.

LuaDoc

diff

Provides functions for diffing text. (c) 2007, 2008 Yuri Takhteyev (yuri@freewisdom.org) (c) 2007 Hisham Muhammad License: MIT/X, see http://sputnik.freewisdom.org/en/License

diff() Returns a diff of two strings as a list of pairs, where the first value represents a token and the second the token's status ("same", "in", "out").
old:
The "old" text string
new:
The "new" text string
separator:
[optional] the separator pattern (defaults ot any white space).
Returns: A list of annotated tokens.
escape_html() Escapes an HTML string.
text:
The string to be escaped.
Returns: Escaped string.
format_as_html() Formats an inline diff as HTML, with and tags.
tokens:
a table of {token, status} pairs.
Returns: an HTML string.
quick_LCS() Derives the longest common subsequence of two strings.
t1:
the first string.
t2:
the second string.
Returns: the least common subsequence as a matrix.
split() Split a string into tokens.
text:
A string to be split.
separator:
[optional] the separator pattern (defaults to any white space - %s+).
skip_separator:
[optional] don't include the sepator in the results.
Returns: A list of tokens.

License

Copyright (c) 2007, 2008 Yuri Takhteyev, Hisham Muhammad

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff-8.06.15/diff/doc/diff.png0000644000175000017500000002057511025410745014450 0ustar yuriyuriPNG  IHDR.UMsRGBbKGD pHYs  tIME2*ߦwtEXtCommentCreated with The GIMPd%n IDATxy\! !,a@ЀYTWܫťjjmW{Z.}mŭōklBYD$@ByFc&e,3yf&79y!B؍ BDP1Q(*& BbP( BDP1Q(*& BbP( BDP1Q(TL BbP( BDi*.x*PAաru"]p芮KϯFAA5/!yuQQ1Q,jJTjlT*BX|>uQHK+Z8"vԂJ-RzzBRN}(f͕1Q^^\9k!PRd h:*&JסX65QPPCD:}%1$(+bt ]j- V7 -ky(a{=dT*i-MsB!|Sa_.WC@РʾLkWxz   Y.}nTL O ,9Sl:Ӕ|>$%]37,)“3XbWTUoްS'=Vh\̘1}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?8!DLL {9þ}XF0tP={6EʵZ-RRR0uTx'9sa~&=;Ćm?xGʏ=l{Cّ#G&M0hР;rFRR\ "<8x5z9sqqqpssIiv|Ly3o>(a#::ۤ\&PСCI\\tch_QQA8ygZ/??l޼966>+ 2`Cz=!:B!Qݯ]vdBBhڀK{ q'/F]]rdҥ&D"@yA._lT|>6mM駟RRRbv^O,YBJ%!*p?Nz=ٳg:u*qrr"'jlܸ^BX,&HUU)))! , #Ȇ Hbb"={6s俗 Hp+ę7x{>G.GL}l%ĉIJJ Y~=3f 6ϭDN8AC+ F,X@~mösŅ9l޼\~ \.ƒ!HPP'/_&';Y~=j346jIii59r y~D(XHybalBȺu@ 0<ٳ$$$|2zho>#.o&Y|9#~.H Diff http://sputnik.freewisdom.org/lib/diff/ http://sputnik.freewisdom.org/files/diff-$version.tar.gz Diff 8.06.15 http://sputnik.freewisdom.org/files/diff-8.06.15.tar.gz the initial release diff-8.06.15/diff/rockspec0000644000175000017500000000103511025410745014007 0ustar yuriyuripackage = "Diff" version = "8.06.15-0" source = { url = "http://sputnik.freewisdom.org/files/diff-8.06.15.tar.gz", } description = { summary = "Diff functions", detailed = [===[ This module provides a small collection of functions for diffing text. ]===], license = "MIT/X11", homepage = "http://sputnik.freewisdom.org/lib/diff/", maintainer = "Yuri Takhteyev (yuri@freewisdom.org)", } dependencies = { } build = { type = "none", install = { lua = { ["diff"] = "lua/diff.lua", } } } diff-8.06.15/diff/petrodoc0000644000175000017500000000331511025410745014020 0ustar yuriyuripackage = 'Diff' versions = { {'8.06.15', 'June 15, 2008', 'the initial release'}, } summary = 'Diff functions' maintainer = 'Yuri Takhteyev (yuri@freewisdom.org)' detailed = [[ This module provides a small collection of functions for diffing text. ]] license = 'MIT/X11' homepage = 'http://sputnik.freewisdom.org/lib/diff/' favicon = 'http://media.freewisdom.org/etc/sputnik-icon.png' download = 'http://sputnik.freewisdom.org/files/diff-$version.tar.gz' --download = "/tmp/versium-$version.tar.gz" push = "scp %s yuri@web10.webfaction.com:~/webapps/static/files/" --push = "cp %s /tmp/" logo = 'diff.png' keywords = 'lua, diff' rss = homepage.."releases.rss" -------------------------------------------------------------------------------- dependencies = [[ ]] Installation = [[ The Diff library consists of a single file (diff.lua), plus a test script (tests/basic.lua). Just put the file somewhere in your Lua path. Here is a list of recent releases: You can also install it using LuaRocks with luarocks install diff or: luarocks --from=http://sputnik.freewisdom.org/rocks/earth install diff ]] TOC = { { "Overview", "

"..detailed.."

" }, { "Installation", markdown(Installation) }, { "Using Diff", markdown(include("doc/howto.md")) }, { "Contact", "Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions."}, { "LuaDoc", make_luadoc{"diff.lua"} }, { "License", markdown(include("LICENSE.txt")) } } ------------------------------------------------------------------------------- diff-8.06.15/diff/LICENSE.txt0000644000175000017500000000207111025410745014077 0ustar yuriyuriCopyright (c) 2007, 2008 Yuri Takhteyev, Hisham Muhammad Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff-8.06.15/diff/tests/0000755000175000017500000000000011025410256013413 5ustar yuriyuridiff-8.06.15/diff/tests/basic.lua0000644000175000017500000000442711025410745015211 0ustar yuriyuri require"diff" -- Print test split TO_BE = [[To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? ]] TO_BE_2 = [[To be, and not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take legs against a sea of troubles, And by opposing end them? ]] HTML_DIFF = [[To <b>be</b>, orand not<i>not</i> to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take armslegs against a sea of troubles, And by opposing end them? ]] SPLIT_1 = { "To", " ", "be,", " ", "or", " ", "not", " ", "to", " ", "be:", "\ ", "that", " ", "is", " ", "the", " ", "question:", "\ ", "Whether", " ", "'tis", " ", "nobler", " ", "in", " ", "the", " ", "mind", " ", "to", " ", "suffer", "\ ", "The", " ", "slings", " ", "and", " ", "arrows", " ", "of", " ", "outrageous", " ", "fortune,", "\ ", "Or", " ", "to", " ", "take", " ", "arms", " ", "against", " ", "a", " ", "sea", " ", "of", " ", "troubles,", "\ ", "And", " ", "by", " ", "opposing", " ", "end", " ", "them?", "\ "} SPLIT_2 = { "To be, or not to be:", " that is the question:", " Whether 'tis nobler in the mind to suffer", " The slings and arrows of outrageous fortune,", " Or to take arms against a sea of troubles,", "And by opposing end them?" } local result = diff.split(TO_BE) for i,v in ipairs(result) do --print(string.format("[%s], [%s]", v, SPLIT_1[i])) assert(v==SPLIT_1[i]) end local result = diff.split(TO_BE, "\n", true) for i,v in ipairs(result) do --print(string.format("[%s], [%s]", v, SPLIT_1[i])) assert(v==SPLIT_2[i]) end --for i, v in ipairs(diff.diff(TO_BE, TO_BE_2)) do -- if v[2]~="same" then -- print (v[1], v[2]) -- end --end d = diff.diff(TO_BE, TO_BE_2):to_html() assert(d == HTML_DIFF) --buffer = "" --for i,v in ipairs(result) do -- buffer = buffer..string.format(" %q,", v) --end --print (buffer) diff-8.06.15/doc/0000755000175000017500000000000011025407756012121 5ustar yuriyuridiff-8.06.15/doc/diff.xcf0000644000175000017500000004552211025407756013543 0ustar yuriyurigimp xcf fileBBaS gimp-commentCreated with The GIMPgimp-image-grid(style intersections) (fgcolor (color-rgba 0.000000 0.000000 0.000000 1.000000)) (bgcolor (color-rgba 1.000000 1.000000 1.000000 1.000000)) (xspacing 10.000000) (yspacing 10.000000) (spacing-unit inches) (xoffset 0.000000) (yoffset 0.000000) (offset-unit inches) $#FHeJ< New Layer#1     [z$ $; q!";"K#}#u 3 2 u 3 2 u \3 \2 \u&z25S1 rN 3 2 )N 3 2 )N \3 \2 \)N&z25S1 r(:95)"                                S:95)"                                S\:\9\5\)\"\\\\ \\\ \\\ \\\ \\ \ \\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\ \\ \\\\\\\\\\\\\\\\\\\\ \\ \\ \\\\ \\\ \S:DL8 j4FzIJlP0 (@߬q*!-v?n6 Xz&^ yL ] ]N Q4i Hq  =Z( WN~  _ 2w ROD F"    LP 7 V4 }dGS07 / \ AL }  Kf;2 r)2MMCxM~9a6yS p) P} ?WK꜔|tlc[UUW^lfmVuׂ'| ©Z R/    ""          )+                            !   /    ""          )+                            !   / \\ \\\\\\\\\\\ \\ \\\\\\\\\\\\"\\"\\ \\ \\ \\ \\ \\\ \\\\\\\\\ \\\ \\\ \ \)\\\\+\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\ \\\ \\\ \\\ \\\ \\\ \\\\\\\\ \\\\ \\\\ \\\ \\\ \ \\ \ \\ \ \\ \ \\ \\\\\ \\ \\ \\ \\ \\ \\ \\ \\!\\ \\ \\ /-O?(Ltwiyt~<ZpIZ p-|D"ME, 9.!Qe!j<<I  zx   G~G]u;*< 4CC V-$Mbob 8 (1,,cmHmH[  &&.^`<`gE*( t6kD0D t{{74 ggw!$!$ZZ`T':K=]]zb-<  1D|@@0zz}BB ) k 33  sGsG F%A)A)PP--]]SESE ``&$&$2626 1 19999888878889999::::; 1 2 4<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$$$$$$$$$$$$$$$$$$$$$$$$$#$f$%%w%3%&&&w&U&D&D&"&(((D&D&D&f&w&&&%U%%%"$w$$3##$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#######$$$$$$$$$$$$$$$$$$#########$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$++w+3,,U--.3 /" 0D1f݈D"==<<D;;w:39887w6f5w4 3 1 30 f.f "*"w(wf$fwwUD݈UU&̈wDDw0++w+3,,U--.3 /" 0D1f݈D"==<<D;;w:39887w6f5w4 3 1 30 f.f "*"w(wf$fwwUD݈UU&̈wDDw0+++,,--. / 0ܡ1á==<<;;:9887654 3 ̈1 0 . ݑ*($̪Ī&Ļ0DUf  U w 3 ++w+D+D+D+,,,+"+D+D+U+w+++*D**)")w)(3('"'&&%D%$w#3""! wff 3!"$$$$$$$$$$$$DUf  U w 3 ++w+D+D+D+,,,+"+D+D+U+w+++*D**)")w)(3('"'&&%D%$w#3""! wff 3!"$$$$$$$$$$$$               !"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@@@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$''''iN4'White2     G5GQHMHYGGGGGGGGH HH-H=@@@@@@@@@@@@''''iN4' Background     I I(J$J0IdItIIIIIIIIJJ@@@@@@@@@@@@''''iN4'Selection Mask JJK:KFK KKKKKK"K&K*K.K2K6@@@'iN4'diff-8.06.15/doc/index.html0000644000175000017500000001544611025407756014130 0ustar yuriyuri Versium

Overview

This module provides a small collection of functions for diffing text.

Installation

The Diff library consists of a single file (diff.lua), plus a test script (tests/basic.lua). Just put the file somewhere in your Lua path. Here is a list of recent releases:

You can also install it using LuaRocks with

luarocks install diff

or:

luarocks --from=http://sputnik.freewisdom.org/rocks/earth install diff

Contact

Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions.

LuaDoc

diff

Provides functions for diffing text. (c) 2007, 2008 Yuri Takhteyev (yuri@freewisdom.org) (c) 2007 Hisham Muhammad License: MIT/X, see http://sputnik.freewisdom.org/en/License

diff() Returns a diff of two strings as a list of pairs, where the first value represents a token and the second the token's status ("same", "in", "out").
old:
The "old" text string
new:
The "new" text string
separator:
[optional] the separator pattern (defaults ot any white space).
Returns: A list of annotated tokens.
escape_html() Escapes an HTML string.
text:
The string to be escaped.
Returns: Escaped string.
format_as_html() Formats an inline diff as HTML, with and tags.
tokens:
a table of {token, status} pairs.
Returns: an HTML string.
quick_LCS() Derives the longest common subsequence of two strings.
t1:
the first string.
t2:
the second string.
Returns: the least common subsequence as a matrix.
split() Split a string into tokens.
text:
A string to be split.
separator:
[optional] the separator pattern (defaults to any white space - %s+).
skip_separator:
[optional] don't include the sepator in the results.
Returns: A list of tokens.

License

Copyright (c) 2007, 2008 Yuri Takhteyev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE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[pdse{'捩v I  11 >kQp/־?3g [aa5dV_kz?)헌bC*рC{ӡCWp)-EErdg•7"y^]..|! pquJJʑs J[<8>3)!jj?<f?5 3g8q8(ZRQQ[YYjHR묊icX7-sN-*5Gaٲ 6} wmxR {N* Sԭkkw9\;"##qaQ1u 5o'O G>R­ Ť p@AAIС>,9!,Lln݊*$''C ix6u> WW=\ !!~7CCf7}F;>!m.ȑQ%6D""#,nظq#lقp/ٵ+Wıc oo!5oLÚ7uʧ مsxiYz>JJ6 t//7V\Xbntxwj*<裈ۅ$$í[M%wdfVBZufsݩSǏgܮc̘1pqqA޽ ߹[q݋xl۶ /_F||C (?~b#F/yرcHHH@Raʔ)MWվmZotzN0%CP_ZLs\)01"N|Of@.Z[y!,, _ =z@ @ Ə?8!DLL {9þ}XF0tP={6EʵZ-RRR0uTx'9sa~&=;Ćm?xGʏ=l{Cّ#G&M0hР;rFRR\ "<8x5z9sqqqpssIiv|Ly3o>(a#::ۤ\&PСCI\\tch_QQA8ygZ/??l޼966>+ 2`Cz=!:B!Qݯ]vdBBhڀK{ q'/F]]rdҥ&D"@yA._lT|>6mM駟RRRbv^O,YBJ%!*p?Nz=ٳg:u*qrr"'jlܸ^BX,&HUU)))! , #Ȇ Hbb"={6s俗 Hp+ę7x{>G.GL}l%ĉIJJ Y~=3f 6ϭDN8AC+ F,X@~mösŅ9l޼\~ \.ƒ!HPP'/_&';Y~=j346jIii59r y~D(XHybalBȺu@ 0<ٳ$$$|2zho>#.o&Y|9#~.H Versium http://sputnik.freewisdom.org/lib/diff/ http://sputnik.freewisdom.org/files/diff-$version.tar.gz Versium 8.06.15 http://sputnik.freewisdom.org/files/diff-8.06.15.tar.gz the initial release diff-8.06.15/rockspec0000644000175000017500000000104011025407756013103 0ustar yuriyuripackage = "Versium" version = "8.06.15-0" source = { url = "http://sputnik.freewisdom.org/files/diff-8.06.15.tar.gz", } description = { summary = "Diff functions", detailed = [===[ This module provides a small collection of functions for diffing text. ]===], license = "MIT/X11", homepage = "http://sputnik.freewisdom.org/lib/diff/", maintainer = "Yuri Takhteyev (yuri@freewisdom.org)", } dependencies = { } build = { type = "none", install = { lua = { ["diff"] = "lua/diff.lua", } } } diff-8.06.15/petrodoc0000644000175000017500000000475211025407756013126 0ustar yuriyuripackage = 'Versium' versions = { {'8.06.15', 'June 15, 2008', 'the initial release'}, } summary = 'Diff functions' maintainer = 'Yuri Takhteyev (yuri@freewisdom.org)' detailed = [[ This module provides a small collection of functions for diffing text. ]] license = 'MIT/X11' homepage = 'http://sputnik.freewisdom.org/lib/diff/' favicon = 'http://media.freewisdom.org/etc/sputnik-icon.png' download = 'http://sputnik.freewisdom.org/files/diff-$version.tar.gz' --download = "/tmp/versium-$version.tar.gz" push = "scp %s yuri@web10.webfaction.com:~/webapps/static/files/" --push = "cp %s /tmp/" logo = 'diff.png' keywords = 'lua, diff' rss = homepage.."releases.rss" -------------------------------------------------------------------------------- dependencies = [[ ]] Installation = [[ The Diff library consists of a single file (diff.lua), plus a test script (tests/basic.lua). Just put the file somewhere in your Lua path. Here is a list of recent releases: You can also install it using LuaRocks with luarocks install diff or: luarocks --from=http://sputnik.freewisdom.org/rocks/earth install diff ]] Using = [[ A simple diff of two strings: > require("diff") > for _, token in ipairs(diff.diff("This is a test", "This was a test!")) do >> print(token[1], token[2]) >> end This same is out was in same a same same test out test! in same That is, diff.diff(old, new) returns a table of pairs, each consisting of a string and it's status: "same" (the string is present in both), "in" (the string appeared in new, or "out" (the string was present in old but was removed). Alternatively, you can just generate an HTML for this diff: > = diff.diff("This is a test", "This was a test!"):to_html() This iswas a testtest! ]] TOC = { { "Overview", "

"..detailed.."

" }, { "Installation", markdown(Installation) }, --{ "Using Diff", markdown(include("doc/howto.md")) }, { "Contact", "Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions."}, { "LuaDoc", make_luadoc{"diff.lua"} }, { "License", markdown(include("LICENSE.txt")) } } ------------------------------------------------------------------------------- diff-8.06.15/LICENSE.txt0000644000175000017500000000205011025407756013174 0ustar yuriyuriCopyright (c) 2007, 2008 Yuri Takhteyev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff-8.06.15/tests/0000755000175000017500000000000011025407756012516 5ustar yuriyuridiff-8.06.15/tests/basic.lua0000644000175000017500000000442711025407756014311 0ustar yuriyuri require"diff" -- Print test split TO_BE = [[To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? ]] TO_BE_2 = [[To be, and not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take legs against a sea of troubles, And by opposing end them? ]] HTML_DIFF = [[To <b>be</b>, orand not<i>not</i> to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take armslegs against a sea of troubles, And by opposing end them? ]] SPLIT_1 = { "To", " ", "be,", " ", "or", " ", "not", " ", "to", " ", "be:", "\ ", "that", " ", "is", " ", "the", " ", "question:", "\ ", "Whether", " ", "'tis", " ", "nobler", " ", "in", " ", "the", " ", "mind", " ", "to", " ", "suffer", "\ ", "The", " ", "slings", " ", "and", " ", "arrows", " ", "of", " ", "outrageous", " ", "fortune,", "\ ", "Or", " ", "to", " ", "take", " ", "arms", " ", "against", " ", "a", " ", "sea", " ", "of", " ", "troubles,", "\ ", "And", " ", "by", " ", "opposing", " ", "end", " ", "them?", "\ "} SPLIT_2 = { "To be, or not to be:", " that is the question:", " Whether 'tis nobler in the mind to suffer", " The slings and arrows of outrageous fortune,", " Or to take arms against a sea of troubles,", "And by opposing end them?" } local result = diff.split(TO_BE) for i,v in ipairs(result) do --print(string.format("[%s], [%s]", v, SPLIT_1[i])) assert(v==SPLIT_1[i]) end local result = diff.split(TO_BE, "\n", true) for i,v in ipairs(result) do --print(string.format("[%s], [%s]", v, SPLIT_1[i])) assert(v==SPLIT_2[i]) end --for i, v in ipairs(diff.diff(TO_BE, TO_BE_2)) do -- if v[2]~="same" then -- print (v[1], v[2]) -- end --end d = diff.diff(TO_BE, TO_BE_2):to_html() assert(d == HTML_DIFF) --buffer = "" --for i,v in ipairs(result) do -- buffer = buffer..string.format(" %q,", v) --end --print (buffer)