Permalink
Browse files

Updating Docco with toString() on Buffers for Node 0.1.95

  • Loading branch information...
1 parent e53a2be commit 6d4e8f0de3acf06f97177d95e4a5befaba2ad26d @jashkenas jashkenas committed May 15, 2010
Showing with 9 additions and 9 deletions.
  1. +3 −3 docco.coffee
  2. +6 −6 index.html
View
@@ -30,7 +30,7 @@
generate_documentation: (source, callback) ->
fs.readFile source, (error, code) ->
throw error if error
- sections: parse source, code
+ sections: parse source, code.toString()
highlight source, sections, ->
generate_html source, sections
callback()
@@ -167,10 +167,10 @@ template: (str) ->
"');}return p.join('');"
# Create the template that we will use to generate the Docco HTML page.
-docco_template: template fs.readFileSync __dirname + '/resources/docco.jst'
+docco_template: template fs.readFileSync(__dirname + '/resources/docco.jst').toString()
# The CSS styles we'd like to apply to the documentation.
-docco_styles: fs.readFileSync __dirname + '/resources/docco.css'
+docco_styles: fs.readFileSync(__dirname + '/resources/docco.css').toString()
# The start of each Pygments highlight block.
highlight_start: '<div class="highlight"><pre>'
View
@@ -2,7 +2,7 @@
documentation generator. It produces HTML that displays your comments
alongside your code. Comments are passed through
<a href="http://daringfireball.net/projects/markdown/syntax">Markdown</a>, and code is
-passed through <a href="<a href='http://pygments.org/'>http://pygments.org/</a>">Pygments</a> syntax highlighting.
+passed through <a href="http://pygments.org/">Pygments</a> syntax highlighting.
This page is the result of running Docco against its own source file.</p>
<p>If you install Docco, you can run it from the command-line:</p>
@@ -13,21 +13,21 @@
<p>...will generate linked HTML documentation for the named source files, saving
it into a <code>docs</code> folder.</p>
-<p>To install Docco, first make sure you have <a href="<a href='http://nodejs.org/'>http://nodejs.org/</a>">Node.js</a>,
-<a href="<a href='http://pygments.org/'>http://pygments.org/</a>">Pygments</a>, and <a href="<a href='http://coffeescript.org/'>http://coffeescript.org/</a>">CoffeeScript</a>.
+<p>To install Docco, first make sure you have <a href="http://nodejs.org/">Node.js</a>,
+<a href="http://pygments.org/">Pygments</a>, and <a href="http://coffeescript.org/">CoffeeScript</a>.
Then, to install system-wide in <code>/usr/local</code>:</p>
<pre><code>sudo cake install
</code></pre>
<p>If <strong>Node.js</strong> doesn't run on your platform, or you'd prefer a more convenient
-package, get <a href="<a href='http://rtomayko.github.com/rocco/'>http://rtomayko.github.com/rocco/</a>">Rocco</a>, the Ruby port that's
+package, get <a href="http://rtomayko.github.com/rocco/">Rocco</a>, the Ruby port that's
available as a gem.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-2">#</a> </div> <h3>Main Documentation Generation Functions</h3> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-3">#</a> </div> <p>Generate the documentation for a source file by reading it in, splitting it
up into comment/code sections, highlighting them for the appropriate language,
and merging them into an HTML template.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">generate_documentation: </span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span> <span class="o">-&gt;</span>
<span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">error</span><span class="p">,</span> <span class="nx">code</span><span class="p">)</span> <span class="o">-&gt;</span>
<span class="k">throw</span> <span class="nx">error</span> <span class="k">if</span> <span class="nx">error</span>
- <span class="nv">sections: </span><span class="nx">parse</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">code</span>
+ <span class="nv">sections: </span><span class="nx">parse</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">code</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span>
<span class="nx">highlight</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">sections</span><span class="p">,</span> <span class="o">-&gt;</span>
<span class="nx">generate_html</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">sections</span>
<span class="nx">callback</span><span class="p">()</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-4">#</a> </div> <p>Given a string of source code, parse out each comment and the code that
@@ -120,7 +120,7 @@
<span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/&lt;%=(.+?)%&gt;/g</span><span class="p">,</span> <span class="s2">&quot;&#39;,$1,&#39;&quot;</span><span class="p">)</span>
<span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;&lt;%&#39;</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;&#39;);&quot;</span><span class="p">)</span>
<span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s1">&#39;%&gt;&#39;</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;p.push(&#39;&quot;</span><span class="p">)</span> <span class="o">+</span>
- <span class="s2">&quot;&#39;);}return p.join(&#39;&#39;);&quot;</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-18">#</a> </div> <p>Create the template that we will use to generate the Docco HTML page.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">docco_template: </span> <span class="nx">template</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s1">&#39;/resources/docco.jst&#39;</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-19">#</a> </div> <p>The CSS styles we'd like to apply to the documentation.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">docco_styles: </span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span> <span class="nx">__dirname</span> <span class="o">+</span> <span class="s1">&#39;/resources/resources/docco.css&#39;</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-20">#</a> </div> <p>The start of each Pygments highlight block.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">highlight_start: </span><span class="s1">&#39;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&#39;</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-21">#</a> </div> <p>The end of each Pygments highlight block.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">highlight_end: </span> <span class="s1">&#39;&lt;/pre&gt;&lt;/div&gt;&#39;</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-22">#</a> </div> <p>Run the script.
+ <span class="s2">&quot;&#39;);}return p.join(&#39;&#39;);&quot;</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-18">#</a> </div> <p>Create the template that we will use to generate the Docco HTML page.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">docco_template: </span> <span class="nx">template</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s1">&#39;/resources/docco.jst&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">()</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-19">#</a> </div> <p>The CSS styles we'd like to apply to the documentation.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">docco_styles: </span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s1">&#39;/resources/resources/docco.css&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">()</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-20">#</a> </div> <p>The start of each Pygments highlight block.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">highlight_start: </span><span class="s1">&#39;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&#39;</span></pre></div> </td> </tr> <tr id="section-21"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-21">#</a> </div> <p>The end of each Pygments highlight block.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">highlight_end: </span> <span class="s1">&#39;&lt;/pre&gt;&lt;/div&gt;&#39;</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="octowrap"> <a class="octothorpe" href="#section-22">#</a> </div> <p>Run the script.
For each source file passed in as an argument, generate the documentation.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">sources: </span><span class="nx">process</span><span class="p">.</span><span class="nx">ARGV</span><span class="p">.</span><span class="nx">sort</span><span class="p">()</span>
<span class="k">if</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">length</span>
<span class="nx">ensure_directory</span> <span class="o">-&gt;</span>

0 comments on commit 6d4e8f0

Please sign in to comment.