Generating TOC
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 1aad62b · Browse files · 5 files·+87 added−48 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+87 added−48 removed
- other:+87 added−48 removed
Provenance
- Commit
0cdc836- Tree
52537bc- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
1aad62b
5 files changed+87 added−48 removed
modified:docs/api.html+40 added-40 removed
149 unmodified lines150 <span class="variable">require</span>(<span class="string">'./request'</span>);151 <span class="variable">require</span>(<span class="string">'./response'</span>);152 </code></pre>153 </td>154-</tr><tr class="filename"><td><h2 id="lib/express/utils.js"><a href="#">utils</a></h2></td><td>lib/express/utils.js</td></tr><tr class="code">155-<td class="docs">156-<p>Parse mini markdown implementation.157-The following conversions are supported,158-primarily for the "flash" middleware:</p>159-160-<p> <em>foo</em> or <em>foo</em> become <em>foo</em>161- <strong>foo</strong> or <strong>foo</strong> become <strong>foo</strong>162- <a href="B">A</a> becomes <a href="B">A</a></p>163-164-<h2></h2>165-166-<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>167-</td>168-<td class="code">169-<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){170- <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)171- .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'<strong>$2</strong>'</span>)172- .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'<em>$2</em>'</span>)173- .<span class="variable">replace</span>(<span class="regexp">/\[([^\]]+)\]\(([^)]+)\)/g</span>, <span class="string">'<a href="$2">$1</a>'</span>);174-};</code></pre>175-</td>176-</tr>177-<tr class="code">178-<td class="docs">179-<p>Escape special characters in the given string of html.</p>180-181-<h2></h2>182-183-<ul><li><p><strong>param</strong>: <em>String</em> html</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>184-</td>185-<td class="code">186-<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {187- <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)188- .<span class="variable">replace</span>(<span class="regexp">/&/g</span>, <span class="string">'&'</span>)189- .<span class="variable">replace</span>(<span class="regexp">/"/g</span>, <span class="string">'"'</span>)190- .<span class="variable">replace</span>(<span class="regexp">/</g</span>, <span class="string">'<'</span>)191- .<span class="variable">replace</span>(<span class="regexp">/>/g</span>, <span class="string">'>'</span>);192-};</code></pre>193-</td>154 </tr><tr class="filename"><td><h2 id="lib/express/request.js"><a href="#">request</a></h2></td><td>lib/express/request.js</td></tr><tr class="code">155 <td class="docs">156 <p>Module dependencies.157 </p>634 unmodified lines792 <span class="keyword">return</span> <span class="variable">arguments</span>.<span class="variable">callee</span>;793 })(<span class="string">'get'</span>)(<span class="string">'post'</span>)(<span class="string">'put'</span>)(<span class="string">'del'</span>);794 </code></pre>795 </td>796+</tr><tr class="filename"><td><h2 id="lib/express/utils.js"><a href="#">utils</a></h2></td><td>lib/express/utils.js</td></tr><tr class="code">797+<td class="docs">798+<p>Parse mini markdown implementation.799+The following conversions are supported,800+primarily for the "flash" middleware:</p>801+802+<p> <em>foo</em> or <em>foo</em> become <em>foo</em>803+ <strong>foo</strong> or <strong>foo</strong> become <strong>foo</strong>804+ <a href="B">A</a> becomes <a href="B">A</a></p>805+806+<h2></h2>807+808+<ul><li><p><strong>param</strong>: <em>String</em> str</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>809+</td>810+<td class="code">811+<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){812+ <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)813+ .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'<strong>$2</strong>'</span>)814+ .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'<em>$2</em>'</span>)815+ .<span class="variable">replace</span>(<span class="regexp">/\[([^\]]+)\]\(([^)]+)\)/g</span>, <span class="string">'<a href="$2">$1</a>'</span>);816+};</code></pre>817+</td>818+</tr>819+<tr class="code">820+<td class="docs">821+<p>Escape special characters in the given string of html.</p>822+823+<h2></h2>824+825+<ul><li><p><strong>param</strong>: <em>String</em> html</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>826+</td>827+<td class="code">828+<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {829+ <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)830+ .<span class="variable">replace</span>(<span class="regexp">/&/g</span>, <span class="string">'&'</span>)831+ .<span class="variable">replace</span>(<span class="regexp">/"/g</span>, <span class="string">'"'</span>)832+ .<span class="variable">replace</span>(<span class="regexp">/</g</span>, <span class="string">'<'</span>)833+ .<span class="variable">replace</span>(<span class="regexp">/>/g</span>, <span class="string">'>'</span>);834+};</code></pre>835+</td>836 </tr><tr class="filename"><td><h2 id="lib/express/view.js"><a href="#">view</a></h2></td><td>lib/express/view.js</td></tr><tr class="code">837 <td class="docs">838 <p>Module dependencies.839 </p>216 unmodified linesmodified:docs/guide.html+22 added-1 removed
145 unmodified lines146 <img alt='Fork me on GitHub' id='ribbon' src='http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png' /> 147 </a>148 <div id="header"><strong>Sencha</strong> labs</div>149 <div id="wrapper">150- <div id="container">150+ <div id="container"><ul id="toc">151+<li><a href="#Installation">Installation</a></li>152+<li><a href="#Creating-An-Application">Creating An Application</a></li>153+<li><a href="#Configuration">Configuration</a></li>154+<li><a href="#Settings">Settings</a></li>155+<li><a href="#Routing">Routing</a></li>156+<li><a href="#Passing-Route-Control">Passing Route Control</a></li>157+<li><a href="#Middleware">Middleware</a></li>158+<li><a href="#ServerRequest-header-key-defaultValue-">ServerRequest#header(key[, defaultValue])</a></li>159+<li><a href="#ServerRequest-accepts-type-">ServerRequest#accepts(type)</a></li>160+<li><a href="#ServerRequest-param-name-">ServerRequest#param(name)</a></li>161+<li><a href="#ServerRequest-flash-type-msg-">ServerRequest#flash(type[, msg])</a></li>162+<li><a href="#ServerRequest-isXMLHttpRequest">ServerRequest#isXMLHttpRequest</a></li>163+<li><a href="#ServerResponse-header-key-val-">ServerResponse#header(key[, val])</a></li>164+<li><a href="#ServerResponse-contentType-type-">ServerResponse#contentType(type)</a></li>165+<li><a href="#ServerResponse-attachment-filename-">ServerResponse#attachment([filename])</a></li>166+<li><a href="#ServerResponse-sendfile-path-">ServerResponse#sendfile(path)</a></li>167+<li><a href="#ServerResponse-download-file-filename-">ServerResponse#download(file[, filename])</a></li>168+<li><a href="#ServerRequest-send-body-status-headers-status-status-">ServerRequest#send(body|status[, headers|status[, status]])</a></li>169+<li><a href="#ServerResponse-redirect-url-status-">ServerResponse#redirect(url[, status])</a></li>170+<li><a href="#Server-redirect-name-val-">Server#redirect(name, val)</a></li>171+</ul>172 <a href='http://github.com/visionmedia/express' id='logo'>Express</a> 173 <p id="tagline">174 High performance, high class web development for175 <a href="http://nodejs.org">Node.js</a>375 unmodified linesadded:support/toc.js+21 added
123456789101112131415161718192021#!/usr/bin/env node
var fs = require('fs'), file = process.argv[2];
if (file) { var js = fs.readFileSync(file, 'utf8'), headers = js.match(/<h3 id="(.*?)">(.*?)<\/h3>/g), toc = ['<ul id="toc">']; if (js.indexOf('id="toc"') < 0) { headers.forEach(function(header){ var captures = header.match(/id="(.*?)">(.*?)</), id = captures[1], title = captures[2]; toc.push('<li><a href="#' + id + '">' + title + '</a></li>'); }); toc.push('</ul>'); js = js.replace('<div id="container">', '<div id="container">' + toc.join('\n')); fs.writeFileSync(file, js); }}No newline at end of filemodified:.pomo-5 removed
21 unmodified lines22 - !ruby/object:Pomo::Task 23 complete: false24 description: 25 length: 2526- name: design mode with browser reloading27-- !ruby/object:Pomo::Task 28- complete: false29- description: 30- length: 2526 name: generated TOC for guidemodified:Makefile+4 added-2 removed
45 unmodified lines46 test-cov:47 @TESTFLAGS=--cov $(MAKE) test48 49 docs: docs/api.html $(MANPAGES) $(HTMLDOCS)50+ @ echo "... generating TOC"51+ @./support/toc.js docs/guide.html52 53 docs/api.html: lib/express/*.js54 dox --title Express \55 --desc "High performance web framework for [node](http://nodejs.org)." \56 $(shell find lib/express/* -type f) > $@57 58 %.1: %.md59 @echo "... $< -> $@"58- @ronn -r --pipe $< > $@ &60+ @ronn -r --pipe $< > $@61 62 %.html: %.md63 @echo "... $< -> $@"64 @ronn -5 --pipe --fragment $< \65 | cat docs/layout/head.html - docs/layout/foot.html \66 | sed 's/NAME/Express/g' \65- > $@ &67+ > $@68 69 docclean:70 rm -f docs/*.{1,html}71 1 unmodified line