1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="Versium: Diff functions"/>
<meta name="keywords" content="lua, diff"/>
<link rel="shortcut icon" href="http://media.freewisdom.org/etc/sputnik-icon.png"/>
<link rel="alternate" type="application/rss+xml" title="New releases of Versium" href='http://sputnik.freewisdom.org/lib/diff/releases.rss'/>
<title>Versium</title>
<style type="text/css">
body { color:#000; background:#fff; }
#header { width:100%;
text-align:center;
border-top:solid #aaa 1px;
border-bottom:solid #aaa 1px;
}
#header p { margin-left:0; }
p { margin-left:3px; }
sup.return {font-size: small;}
a.return {text-decoration: none; color: gray;}
pre { background-color:#ffe; white-space:pre; padding-left:3ex; border-left: 1px solid gray; margin-left: 10px}
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
table.index ul { padding-top: 0em; margin-top: 0em; }
table {
border: 1px solid black;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
}
th {
border: 1px solid black;
padding: 0.5em;
}
td {
border: 1px solid black;
padding: 0.5em;
}
div.header, div.footer { margin-left: 0em; }
</style>
</head>
<body>
<div id="header">
<a name="top"></a>
<img border=0 alt="Versium logo" src="diff.png"/>
<p>Diff functions</p>
<p>
<a name="toc"></a><a href="#Overview">Overview</a> · <a href="#Installation">Installation</a> · <a href="#Contact">Contact</a> · <a href="#LuaDoc">LuaDoc</a> · <a href="#License">License</a>
</p>
</div>
<a name="Overview"></a><h1>Overview<sup class="return"><a class="return" href="#top">↑</a></sup></h1>
<p> This module provides a small collection of functions for diffing text.
</p>
<a name="Installation"></a><h1>Installation<sup class="return"><a class="return" href="#top">↑</a></sup></h1>
<p> 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:</p>
<p> <ul>
<li><a href="http://sputnik.freewisdom.org/files/diff-8.06.15.tar.gz">Versium-8.06.15</a> - the initial release (June 15, 2008) </li>
</ul></p>
<p> You can also install it using LuaRocks with</p>
<pre><code>luarocks install diff
</code></pre>
<p> or:</p>
<pre><code>luarocks --from=http://sputnik.freewisdom.org/rocks/earth install diff
</code></pre>
<a name="Contact"></a><h1>Contact<sup class="return"><a class="return" href="#top">↑</a></sup></h1>
Please contact Yuri Takhteyev (yuri -at- freewisdom.org) with any questions.
<a name="LuaDoc"></a><h1>LuaDoc<sup class="return"><a class="return" href="#top">↑</a></sup></h1>
<table style="width:100%" class="function_list">
<tr>
<td colspan=2 style='background: #dddddd;'>
<h2>diff</h2>
<p>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 </p>
</td>
</tr>
<tr>
<td class="name" width="300px" style="vertical-align: top;"><b>diff()</b></td>
<td class="summary" >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").
<dl>
<dt><color="green"><b>old</b></font>: <dd>The "old" text string</dd></dt><dt><color="green"><b>new</b></font>: <dd>The "new" text string</dd></dt><dt><color="green"><b>separator</b></font>: <dd>[optional] the separator pattern (defaults ot any white space).</dd></dt>
</dl>
Returns: <font color="purple">A list of annotated tokens. </color>
</td>
</tr>
<tr>
<td class="name" width="300px" style="vertical-align: top;"><b>escape_html()</b></td>
<td class="summary" >Escapes an HTML string.
<dl>
<dt><color="green"><b>text</b></font>: <dd>The string to be escaped.</dd></dt>
</dl>
Returns: <font color="purple">Escaped string. </color>
</td>
</tr>
<tr>
<td class="name" width="300px" style="vertical-align: top;"><b>format_as_html()</b></td>
<td class="summary" >Formats an inline diff as HTML, with <ins> and <del> tags.
<dl>
<dt><color="green"><b>tokens</b></font>: <dd>a table of {token, status} pairs.</dd></dt>
</dl>
Returns: <font color="purple">an HTML string. </color>
</td>
</tr>
<tr>
<td class="name" width="300px" style="vertical-align: top;"><b>quick_LCS()</b></td>
<td class="summary" >Derives the longest common subsequence of two strings.
<dl>
<dt><color="green"><b>t1</b></font>: <dd>the first string.</dd></dt><dt><color="green"><b>t2</b></font>: <dd>the second string.</dd></dt>
</dl>
Returns: <font color="purple">the least common subsequence as a matrix. </color>
</td>
</tr>
<tr>
<td class="name" width="300px" style="vertical-align: top;"><b>split()</b></td>
<td class="summary" >Split a string into tokens.
<dl>
<dt><color="green"><b>text</b></font>: <dd>A string to be split.</dd></dt><dt><color="green"><b>separator</b></font>: <dd>[optional] the separator pattern (defaults to any white space - %s+).</dd></dt><dt><color="green"><b>skip_separator</b></font>: <dd>[optional] don't include the sepator in the results.</dd></dt>
</dl>
Returns: <font color="purple">A list of tokens. </color>
</td>
</tr>
</table>
<a name="License"></a><h1>License<sup class="return"><a class="return" href="#top">↑</a></sup></h1>
<p>Copyright (c) 2007, 2008 Yuri Takhteyev</p>
<p>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:</p>
<p>The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.</p>
<p>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.</p>
</body>
</html>
|