<commit_before><!DOCTYPE html>  <html> <head>   <title>revisionist.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               revisionist.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <h2>Utility functions</h2>

<p>HTML annotated Diff function</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">htmlDiff = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./lib/diff&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Extend function</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">extend = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./lib/extend.coffee&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <h2>The Revisionist Class</h2>

<p>The main public Class. When you create an instance of Revisionist, this is the public API you get back.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">Revisionist</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>The internal cache</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_cache = </span><span class="p">[]</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>The plugin registry</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_plugins = </span><span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>The version pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_currentVersion = </span><span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Helper function for getting the previous version of the current one.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_getPreviousVersion = </span><span class="nf">-&gt;</span>
    <span class="nv">version = </span><span class="nx">_currentVersion</span> <span class="o">-</span> <span class="mi">1</span>

    <span class="k">if</span> <span class="nx">version</span> <span class="o">&lt;</span> <span class="mi">0</span>
      <span class="nv">version = </span><span class="mi">0</span>

    <span class="k">return</span> <span class="nx">version</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>This class method lets you register a new plugin.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@registerPlugin: </span><span class="nf">(namespace, Plugin) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Do not register the plugin if one with the same namespace already exists</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;There&#39;s already a plugin in this namespace&quot;</span><span class="p">)</span>

    <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="nx">Plugin</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>This class method unregisters an existing plugin</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@unregisterPlugin: </span><span class="nf">(namespace) -&gt;</span>
    <span class="k">unless</span> <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;This plugin doesn&#39;t exist&quot;</span><span class="p">)</span>

    <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="kc">null</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>The default options:</p>

<p><strong>versions</strong>:
The maximum number of versions you wish to store. The default is 10.</p>

<p><strong>plugin</strong>:
The plugin you wish to use. The default is "simple"</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">defaults:</span>
    <span class="nv">versions: </span><span class="mi">10</span>
    <span class="nv">plugin: </span><span class="s">&#39;simple&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>The main constructor function that gets called when Revisionist is instantiated.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">constructor: </span><span class="nf">(options) -&gt;</span>
    <span class="vi">@options = </span><span class="p">{}</span>
    <span class="nx">extend</span> <span class="nx">@options</span><span class="p">,</span> <span class="nx">@defaults</span>
    <span class="nx">extend</span> <span class="nx">@options</span><span class="p">,</span> <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Implements a getter for _currentVersion</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">getLatestVersionNumber: </span><span class="nf">-&gt;</span>
    <span class="nx">_currentVersion</span><span class="o">-</span><span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Adds a new revision for this instance.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">change: </span><span class="nf">(newValue) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-15">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-15">&#182;</a>               </div>               <p>Check if the plugin is available</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">plugin = </span><span class="nx">_plugins</span><span class="p">[</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="p">]</span>

    <span class="k">unless</span> <span class="nx">plugin</span><span class="o">?</span><span class="p">.</span><span class="nx">change</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Plugin </span><span class="si">#{</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="si">}</span><span class="s"> is not available!&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-16">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-16">&#182;</a>               </div>               <p>Call the plugin's "change" function and get it's return value for storing.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">newValue = </span><span class="nx">plugin</span><span class="p">.</span><span class="nx">change</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">plugin</span><span class="p">,</span> <span class="nx">newValue</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-17">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-17">&#182;</a>               </div>               <p>Bump the current version number</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">_currentVersion</span> <span class="o">+=</span> <span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Store the new version</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">_cache</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">newValue</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-19">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-19">&#182;</a>               </div>               <p>Keep the internal cache trimmed according to the "versions" option.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">_currentVersion</span> <span class="o">&gt;</span> <span class="nx">@options</span><span class="p">.</span><span class="nx">versions</span></pre></div>             </td>           </tr>                               <tr id="section-20">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-20">&#182;</a>               </div>               <p>Remove the oldest version</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nx">_cache</span><span class="p">.</span><span class="nx">shift</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-21">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-21">&#182;</a>               </div>               <p>Keep the _currentVersion pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">_currentVersion = </span><span class="nx">_cache</span><span class="p">.</span><span class="nx">length</span>

    <span class="k">return</span> <span class="nx">newValue</span></pre></div>             </td>           </tr>                               <tr id="section-22">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-22">&#182;</a>               </div>               <p>Recovers a specific revision from the cache</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">recover: </span><span class="nf">(version) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-23">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-23">&#182;</a>               </div>               <p>Check if the plugin is available</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">plugin = </span><span class="nx">_plugins</span><span class="p">[</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="p">]</span>

    <span class="k">unless</span> <span class="nx">plugin</span><span class="o">?</span><span class="p">.</span><span class="nx">recover</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Plugin </span><span class="si">#{</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="si">}</span><span class="s"> is not available!&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-24">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-24">&#182;</a>               </div>               <p>Defaults to the current version - 1</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">version</span><span class="o">?</span>
      <span class="nv">version = </span><span class="nx">_getPreviousVersion</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-25">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-25">&#182;</a>               </div>               <p>Throw errors if the version is out of bounds</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">version</span> <span class="o">&lt;</span> <span class="mi">0</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Version needs to be a positive number&quot;</span><span class="p">)</span>

    <span class="k">if</span> <span class="nx">version</span> <span class="o">&gt;</span> <span class="nx">_cache</span><span class="p">.</span><span class="nx">length</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;This version doesn&#39;t exist&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-26">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-26">&#182;</a>               </div>               <p>Call the plugin's "recover" function and return it's return value.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">plugin</span><span class="p">.</span><span class="nx">recover</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">plugin</span><span class="p">,</span> <span class="nx">_cache</span><span class="p">[</span><span class="nx">version</span><span class="p">])</span></pre></div>             </td>           </tr>                               <tr id="section-27">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-27">&#182;</a>               </div>               <p>Represents the difference between two versions.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">diff: </span><span class="nf">(v1, v2) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-28">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-28">&#182;</a>               </div>               <p>If no v1 is passed in, the current version is assumed</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">v1</span><span class="o">?</span>
      <span class="nv">v1 = </span><span class="nx">_currentVersion</span> <span class="o">-</span> <span class="mi">1</span>
      <span class="nv">v1 = </span><span class="mi">0</span> <span class="k">if</span> <span class="nx">v1</span> <span class="o">&lt;</span> <span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-29">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-29">&#182;</a>               </div>               <p>If no v2 is passed in, v1 - 1 is assumed.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">v2</span><span class="o">?</span>
      <span class="nv">v2 = </span><span class="nx">v1</span> <span class="o">-</span> <span class="mi">1</span>
      <span class="nv">v2 = </span><span class="mi">0</span> <span class="k">if</span> <span class="nx">v2</span> <span class="o">&lt;</span> <span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-30">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-30">&#182;</a>               </div>               <p>Figure out which one is the old value and the new value</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">min = </span><span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">)</span>
    <span class="nv">max = </span><span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-31">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-31">&#182;</a>               </div>               <p>Returns the diff hash</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">return</span> <span class="p">{</span>
      <span class="nv">old: </span><span class="nx">@recover</span><span class="p">(</span><span class="nx">min</span><span class="p">)</span>
      <span class="k">new</span><span class="o">:</span> <span class="nx">@recover</span><span class="p">(</span><span class="nx">max</span><span class="p">)</span>
    <span class="p">}</span>

  <span class="nv">visualDiff: </span><span class="nf">(v1, v2) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-32">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-32">&#182;</a>               </div>               <p>Pipes diff() into the htmlDiff() module</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">diff = </span><span class="nx">@diff</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-33">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-33">&#182;</a>               </div>               <p>Bail out if both versions are not Strings</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="k">typeof</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">old</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span> <span class="o">and</span> <span class="k">typeof</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">new</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&#39;The content types of both versions must match&#39;</span><span class="p">)</span>

    <span class="k">return</span> <span class="nx">htmlDiff</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">old</span><span class="p">,</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">new</span></pre></div>             </td>           </tr>                               <tr id="section-34">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-34">&#182;</a>               </div>               <p>Clears the cache</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">clear: </span><span class="nf">-&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-35">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-35">&#182;</a>               </div>               <p>Reset the internal cache</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">_cache = </span><span class="p">[]</span></pre></div>             </td>           </tr>                               <tr id="section-36">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-36">&#182;</a>               </div>               <p>Reset the version pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">_currentVersion = </span><span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-37">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-37">&#182;</a>               </div>               <p>Chain 'this' through</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">return</span> <span class="nx">@</span></pre></div>             </td>           </tr>                               <tr id="section-38">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-38">&#182;</a>               </div>               <h2>Simple Plugin</h2>

<p>This is a reference implementation for a plugin.
It simply stores the values as they are passed in.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">SimplePlugin =</span>
  <span class="nv">change: </span><span class="nf">(newValue) -&gt;</span>
    <span class="k">return</span> <span class="nx">newValue</span>

  <span class="nv">recover: </span><span class="nf">(prevValue) -&gt;</span>
    <span class="k">return</span> <span class="nx">prevValue</span></pre></div>             </td>           </tr>                               <tr id="section-39">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-39">&#182;</a>               </div>               <p>Registers the SimplePlugin</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">Revisionist</span><span class="p">.</span><span class="nx">registerPlugin</span><span class="p">(</span><span class="s">&#39;simple&#39;</span><span class="p">,</span> <span class="nx">SimplePlugin</span><span class="p">)</span>

<span class="nv">module.exports = </span><span class="nx">Revisionist</span>

</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> <commit_msg>Updates annotated source<commit_after><!DOCTYPE html>  <html> <head>   <title>revisionist.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               revisionist.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <h2>Utility functions</h2>

<p>HTML annotated Diff function</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">htmlDiff = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./lib/diff&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Extend function</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">extend = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./lib/extend.coffee&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <h2>The Revisionist Class</h2>

<p>The main public Class. When you create an instance of Revisionist, this is the public API you get back.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="k">class</span> <span class="nx">Revisionist</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>The plugin registry</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_plugins = </span><span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>The store registry</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_stores = </span><span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>The version pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_currentVersion = </span><span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>The internal store</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_store = </span><span class="kc">null</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Helper function for getting the previous version of the current one.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">_getPreviousVersion = </span><span class="nf">-&gt;</span>
    <span class="nv">version = </span><span class="nx">_currentVersion</span> <span class="o">-</span> <span class="mi">1</span>

    <span class="k">if</span> <span class="nx">version</span> <span class="o">&lt;</span> <span class="mi">0</span>
      <span class="nv">version = </span><span class="mi">0</span>

    <span class="k">return</span> <span class="nx">version</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>This class method lets you register a new plugin.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@registerPlugin: </span><span class="nf">(namespace, Plugin) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Do not register the plugin if one with the same namespace already exists</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;There&#39;s already a plugin in this namespace&quot;</span><span class="p">)</span>

    <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="nx">Plugin</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>This class method unregisters an existing plugin</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@unregisterPlugin: </span><span class="nf">(namespace) -&gt;</span>
    <span class="nx">_plugins</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="kc">null</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>This class method lets you register a new store</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@registerStore: </span><span class="nf">(namespace, Store) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Do not register the store if one with the same namespace already exists</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">_stores</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;There&#39;s already a store in this namespace&quot;</span><span class="p">)</span>

    <span class="nx">_stores</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="nx">Store</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>This class method unregisters an existing store</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="vi">@unregisterStore: </span><span class="nf">(namespace) -&gt;</span>
    <span class="nx">_stores</span><span class="p">[</span><span class="nx">namespace</span><span class="p">]</span> <span class="o">=</span> <span class="kc">null</span></pre></div>             </td>           </tr>                               <tr id="section-15">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-15">&#182;</a>               </div>               <p>The default options:</p>

<p><strong>versions</strong>:
The maximum number of versions you wish to store. The default is 10.</p>

<p><strong>plugin</strong>:
The plugin you wish to use. The default is "simple"</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">defaults:</span>
    <span class="nv">versions: </span><span class="mi">10</span>
    <span class="nv">plugin: </span><span class="s">&#39;simple&#39;</span>
    <span class="nv">store: </span><span class="s">&#39;simple&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-16">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-16">&#182;</a>               </div>               <p>The main constructor function that gets called when Revisionist is instantiated.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">constructor: </span><span class="nf">(options) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-17">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-17">&#182;</a>               </div>               <p>Configures options</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="vi">@options = </span><span class="p">{}</span>
    <span class="nx">extend</span> <span class="nx">@options</span><span class="p">,</span> <span class="nx">@defaults</span>
    <span class="nx">extend</span> <span class="nx">@options</span><span class="p">,</span> <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Configure store</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">@setStore</span><span class="p">(</span><span class="nx">@options</span><span class="p">.</span><span class="nx">store</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-19">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-19">&#182;</a>               </div>               <p>Implements a getter for _currentVersion</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">getLatestVersionNumber: </span><span class="nf">-&gt;</span>
    <span class="nx">_currentVersion</span><span class="o">-</span><span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-20">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-20">&#182;</a>               </div>               <p>Sets the internal store</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">setStore: </span><span class="nf">(store) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-21">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-21">&#182;</a>               </div>               <p>Bail if the chosen store is not available in the store registry</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">Store = </span><span class="nx">_stores</span><span class="p">[</span><span class="nx">store</span><span class="p">]</span>
    <span class="k">unless</span> <span class="nx">Store</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;The Store &#39;</span><span class="si">#{</span><span class="nx">store</span><span class="si">}</span><span class="s">&#39; is not available!&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-22">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-22">&#182;</a>               </div>               <p>Construct the Store</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">_store = </span><span class="k">new</span> <span class="nx">Store</span><span class="p">(</span><span class="nx">@options</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-23">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-23">&#182;</a>               </div>               <p>Adds a new revision for this instance.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">change: </span><span class="nf">(newValue) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-24">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-24">&#182;</a>               </div>               <p>Check if the plugin is available</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">plugin = </span><span class="nx">_plugins</span><span class="p">[</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="p">]</span>

    <span class="k">unless</span> <span class="nx">plugin</span><span class="o">?</span><span class="p">.</span><span class="nx">change</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Plugin </span><span class="si">#{</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="si">}</span><span class="s"> is not available!&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-25">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-25">&#182;</a>               </div>               <p>Call the plugin's "change" function and get it's return value for storing.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">newValue = </span><span class="nx">plugin</span><span class="p">.</span><span class="nx">change</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">plugin</span><span class="p">,</span> <span class="nx">newValue</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-26">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-26">&#182;</a>               </div>               <p>Bump the current version number</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">_currentVersion</span> <span class="o">+=</span> <span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-27">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-27">&#182;</a>               </div>               <p>Save the new version</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">_store</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="nx">newValue</span><span class="p">,</span> <span class="nx">_currentVersion</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-28">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-28">&#182;</a>               </div>               <p>Keep the internal cache trimmed according to the "versions" option.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">_currentVersion</span> <span class="o">&gt;</span> <span class="nx">@options</span><span class="p">.</span><span class="nx">versions</span></pre></div>             </td>           </tr>                               <tr id="section-29">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-29">&#182;</a>               </div>               <p>Remove the oldest version</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nx">_store</span><span class="p">.</span><span class="nx">remove</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-30">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-30">&#182;</a>               </div>               <p>Keep the _currentVersion pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">_currentVersion = </span><span class="nx">_store</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span>

    <span class="k">return</span> <span class="nx">newValue</span></pre></div>             </td>           </tr>                               <tr id="section-31">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-31">&#182;</a>               </div>               <p>Recovers a specific revision from the cache</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">recover: </span><span class="nf">(version, callback) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-32">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-32">&#182;</a>               </div>               <p>Check if the plugin is available</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">plugin = </span><span class="nx">_plugins</span><span class="p">[</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="p">]</span>

    <span class="k">unless</span> <span class="nx">plugin</span><span class="o">?</span><span class="p">.</span><span class="nx">recover</span><span class="o">?</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Plugin </span><span class="si">#{</span><span class="nx">@options</span><span class="p">.</span><span class="nx">plugin</span><span class="si">}</span><span class="s"> is not available!&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-33">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-33">&#182;</a>               </div>               <p>Defaults to the current version - 1</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">version</span><span class="o">?</span>
      <span class="nv">version = </span><span class="nx">_getPreviousVersion</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-34">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-34">&#182;</a>               </div>               <p>Throw errors if the version is out of bounds</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="nx">version</span> <span class="o">&lt;</span> <span class="mi">0</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;Version needs to be a positive number&quot;</span><span class="p">)</span>

    <span class="k">if</span> <span class="nx">version</span> <span class="o">&gt;</span> <span class="nx">_store</span><span class="p">.</span><span class="nx">size</span><span class="p">()</span>
      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&quot;This version doesn&#39;t exist&quot;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-35">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-35">&#182;</a>               </div>               <p>Call the plugin's "recover" function and return it's return value.
plugin.recover.call(plugin, _store.get(version))</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-36">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-36">&#182;</a>               </div>               <p>Call the plugin's "recover" function and return it using the callback</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="k">typeof</span> <span class="nx">callback</span> <span class="o">is</span> <span class="s">&#39;function&#39;</span>
      <span class="nx">_store</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">version</span><span class="p">,</span> <span class="nf">(data) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-37">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-37">&#182;</a>               </div>               <p>Pipe the data through from the plugin to the callback</p>             </td>             <td class="code">               <div class="highlight"><pre>        <span class="nx">callback</span><span class="p">(</span><span class="nx">plugin</span><span class="p">.</span><span class="nx">recover</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">plugin</span><span class="p">,</span> <span class="nx">data</span><span class="p">))</span>
      <span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-38">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-38">&#182;</a>               </div>               <p>Represents the difference between two versions.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">diff: </span><span class="nf">(v1, v2, callback) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-39">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-39">&#182;</a>               </div>               <p>If no v1 is passed in, the current version is assumed</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">v1</span><span class="o">?</span>
      <span class="nv">v1 = </span><span class="nx">_currentVersion</span> <span class="o">-</span> <span class="mi">1</span>
      <span class="nv">v1 = </span><span class="mi">0</span> <span class="k">if</span> <span class="nx">v1</span> <span class="o">&lt;</span> <span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-40">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-40">&#182;</a>               </div>               <p>If no v2 is passed in, v1 - 1 is assumed.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">unless</span> <span class="nx">v2</span><span class="o">?</span>
      <span class="nv">v2 = </span><span class="nx">v1</span> <span class="o">-</span> <span class="mi">1</span>
      <span class="nv">v2 = </span><span class="mi">0</span> <span class="k">if</span> <span class="nx">v2</span> <span class="o">&lt;</span> <span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-41">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-41">&#182;</a>               </div>               <p>Figure out which one is the old value and the new value</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">min = </span><span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">)</span>
    <span class="nv">max = </span><span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-42">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-42">&#182;</a>               </div>               <p>Returns the diff hash</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">if</span> <span class="k">typeof</span> <span class="nx">callback</span> <span class="o">is</span> <span class="s">&#39;function&#39;</span>
      <span class="nx">_store</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">min</span><span class="p">,</span> <span class="nf">(old) -&gt;</span>
        <span class="nx">_store</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="nx">max</span><span class="p">,</span> <span class="nf">(n) -&gt;</span>
          <span class="nx">callback</span> <span class="p">{</span><span class="nv">old: </span><span class="nx">old</span><span class="p">,</span> <span class="k">new</span><span class="o">:</span> <span class="nx">n</span><span class="p">}</span>
        <span class="p">)</span>
      <span class="p">)</span>

  <span class="nv">visualDiff: </span><span class="nf">(v1, v2, callback) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-43">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-43">&#182;</a>               </div>               <p>Pipes diff() into the htmlDiff() module</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">@diff</span><span class="p">(</span><span class="nx">v1</span><span class="p">,</span> <span class="nx">v2</span><span class="p">,</span> <span class="nf">(diff) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-44">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-44">&#182;</a>               </div>               <p>Bail out if both versions are not Strings</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="k">unless</span> <span class="k">typeof</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">old</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span> <span class="o">and</span> <span class="k">typeof</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">new</span> <span class="o">is</span> <span class="s">&#39;string&#39;</span>
        <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s">&#39;The content types of both versions must match&#39;</span><span class="p">)</span>

      <span class="nx">callback</span><span class="p">(</span> <span class="nx">htmlDiff</span><span class="p">(</span><span class="nx">diff</span><span class="p">.</span><span class="nx">old</span><span class="p">,</span> <span class="nx">diff</span><span class="p">.</span><span class="nx">new</span><span class="p">)</span> <span class="p">)</span>
    <span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-45">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-45">&#182;</a>               </div>               <p>Clears the cache</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">clear: </span><span class="nf">-&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-46">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-46">&#182;</a>               </div>               <p>Reset the store</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">_store</span><span class="p">.</span><span class="nx">clear</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-47">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-47">&#182;</a>               </div>               <p>Reset the version pointer</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">_currentVersion = </span><span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-48">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-48">&#182;</a>               </div>               <p>Chain 'this' through</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="k">return</span> <span class="nx">@</span></pre></div>             </td>           </tr>                               <tr id="section-49">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-49">&#182;</a>               </div>               <p>Simple Plugin, a reference implementation of a Revisionist plugin</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">SimplePlugin = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./plugins/simple.coffee&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-50">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-50">&#182;</a>               </div>               <p>Registers SimplePlugin</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">Revisionist</span><span class="p">.</span><span class="nx">registerPlugin</span><span class="p">(</span><span class="s">&#39;simple&#39;</span><span class="p">,</span> <span class="nx">SimplePlugin</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-51">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-51">&#182;</a>               </div>               <p>Simple Store, a reference implementation of a Revisionist Store</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">SimpleStore = </span><span class="nx">require</span><span class="p">(</span><span class="s">&#39;./stores/simple.coffee&#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-52">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-52">&#182;</a>               </div>               <p>Registers SimpleStore</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">Revisionist</span><span class="p">.</span><span class="nx">registerStore</span><span class="p">(</span><span class="s">&#39;simple&#39;</span><span class="p">,</span> <span class="nx">SimpleStore</span><span class="p">)</span>

<span class="nv">module.exports = </span><span class="nx">Revisionist</span>

</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
{'fraction_non_alphanumeric': 0.21718100796092488, 'fraction_numerical': 0.012718449681245837, 'mean_word_length': 1.9843350686228112, 'pattern_counts': {'":': 0, '<': 3145, '<?xml version=': 0, '>': 3145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 91, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2186165', 'n_tokens_mistral': 18518, 'n_tokens_neox': 17856, 'n_words': 3662}