Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (65 sloc) 2.48 KB
package = '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:
<ul>
$do_versions[=[<li><a href="$url">$package-$version</a> - $comment ($date) </li> ]=]
</ul>
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 <i>new</i>, or "out" (the string was present in <i>old</i> 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>
]]
TOC = {
{ "Overview", "<p>"..detailed.."</p>" },
{ "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")) }
}
-------------------------------------------------------------------------------