Fixed reload views example
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 492f70f · Browse files · 4 files·+210 added−210 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+210 added−210 removed
- other:+210 added−210 removed
Provenance
- Commit
5fcf971- Tree
a77e1c5- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent
492f70f
4 files changed+210 added−210 removed
modified:docs/api.html+207 added-207 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/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>158+</td>159+<td class="code">160+<pre><code><span class="keyword">var</span> <span class="variable">http</span> = <span class="variable">require</span>(<span class="string">'http'</span>),161+ <span class="variable">utils</span> = <span class="variable">require</span>(<span class="string">'./utils'</span>),162+ <span class="variable">mime</span> = <span class="variable">require</span>(<span class="string">'connect/utils'</span>).<span class="variable">mime</span>;</code></pre>163+</td>164+</tr>165+<tr class="code">166+<td class="docs">167+<p>Return request header or optional default.</p>168+169+<h2>Examples</h2>170+171+<pre><code>req.header('Content-Type');172+// => "text/plain"173+174+req.header('content-type');175+// => "text/plain"176+177+req.header('Accept');178+// => undefined179+180+req.header('Accept', 'text/html');181+// => "text/html"</code></pre>182+183+<h2></h2>184+185+<ul><li><p><strong>param</strong>: <em>String</em> name</p></li><li><p><strong>param</strong>: <em>String</em> defaultValue</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>186+</td>187+<td class="code">188+<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">header</span> = <span class="keyword">function</span>(<span class="variable">name</span>, <span class="variable">defaultValue</span>){189+ <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">headers</span>[<span class="variable">name</span>.<span class="variable">toLowerCase</span>()] || <span class="variable">defaultValue</span>;190+};</code></pre>191+</td>192+</tr>193+<tr class="code">194+<td class="docs">195+<p>Check if the <em>Accept</em> header is present, and includes the given <code>type</code>.</p>196+197+<p>When the <em>Accept</em> header is not present <code>true</code> is returned. Otherwise198+the given <code>type</code> is matched by an exact match, and then subtypes. You199+may pass the subtype such as "html" which is then converted internally200+to "text/html" using the mime lookup table.</p>201+202+<h2>Examples</h2>203+204+<pre><code>// Accept: text/html205+req.accepts('html');206+// => true207+208+// Accept: text/*; application/json209+req.accepts('html');210+req.accepts('text/html');211+req.accepts('text/plain');212+req.accepts('application/json');213+// => true214+215+req.accepts('image/png');216+req.accepts('png');217+// => false</code></pre>218+219+<h2></h2>220+221+<ul><li><p><strong>param</strong>: <em>String</em> type</p></li><li><p><strong>return</strong>: <em>Boolean</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>222+</td>223+<td class="code">224+<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">accepts</span> = <span class="keyword">function</span>(<span class="variable">type</span>){225+ <span class="keyword">var</span> <span class="variable">accept</span> = <span class="this">this</span>.<span class="variable">header</span>(<span class="string">'Accept'</span>);226+ <span class="keyword">if</span> (!<span class="variable">accept</span> || <span class="variable">accept</span> === '*</code></pre>227+</td>228+</tr>229+<tr class="code">230+<td class="docs">231+<p>') {232+ return true;233+ } else if (type) {234+ // Allow "html" vs "text/html" etc235+ if (type.indexOf('/') < 0) {236+ type = mime.types['.' + type];237+ }238+ // Check if we have a direct match239+ if (accept.indexOf(type) >= 0) {240+ return true;241+ // Check if we have type/<em>242+ } else {243+ type = type.split('/')[0] + '/</em>';244+ return accept.indexOf(type) >= 0;245+ }246+ } else {247+ return false;248+ }249+};</p>250+251+<p>/**252+Return the value of param <code>name</code> when present.</p>253+254+<ul><li>Checks route placeholders, ex: <em>/user/:id</em></li><li>Checks query string params, ex: ?id=12</li><li>Checks urlencoded body params, ex: id=12</li></ul>255+256+<p>To utilize urlencoded request bodies, <code>req.body</code>257+should be an object. This can be done by using258+the <code>connect.bodyDecoder</code> middleware.</p>259+260+<h2></h2>261+262+<ul><li><p><strong>param</strong>: <em>String</em> name</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>263+</td>264+<td class="code">265+<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">param</span> = <span class="keyword">function</span>(<span class="variable">name</span>){266+ <span class="comment">// Route params like /user/:id</span>267+ <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {268+ <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>]; 269+ }270+ <span class="comment">// Query string params</span>271+ <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {272+ <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>]; 273+ }274+ <span class="comment">// Request body params via connect.bodyDecoder</span>275+ <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">body</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {276+ <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>];277+ }278+};</code></pre>279+</td>280+</tr>281+<tr class="code">282+<td class="docs">283+<p>Queue flash <code>msg</code> of the given <code>type</code>.</p>284+285+<h2>Examples</h2>286+287+<pre><code> req.flash('info', 'email sent');288+ req.flash('error', 'email delivery failed');289+ req.flash('info', 'email re-sent');290+ // => 2291+292+ req.flash('info');293+ // => ['email sent', 'email re-sent']294+295+ req.flash('info');296+ // => []297+298+ req.flash();299+ // => { error: ['email delivery failed'], info: [] }</code></pre>300+301+<h2></h2>302+303+<ul><li><p><strong>param</strong>: <em>String</em> type</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>return</strong>: <em>Array | Object | Number</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>304+</td>305+<td class="code">306+<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">flash</span> = <span class="keyword">function</span>(<span class="variable">type</span>, <span class="variable">msg</span>){307+ <span class="keyword">var</span> <span class="variable">msgs</span> = <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> = <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> || {};308+ <span class="keyword">if</span> (<span class="variable">type</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="variable">msg</span>) {309+ <span class="variable">msg</span> = <span class="variable">utils</span>.<span class="variable">miniMarkdown</span>(<span class="variable">utils</span>.<span class="variable">htmlEscape</span>(<span class="variable">msg</span>));310+ <span class="keyword">return</span> (<span class="variable">msgs</span>[<span class="variable">type</span>] = <span class="variable">msgs</span>[<span class="variable">type</span>] || []).<span class="variable">push</span>(<span class="variable">msg</span>);311+ } <span class="keyword">else</span> <span class="keyword">if</span> (<span class="variable">type</span>) {312+ <span class="keyword">var</span> <span class="variable">arr</span> = <span class="variable">msgs</span>[<span class="variable">type</span>];313+ <span class="keyword">delete</span> <span class="variable">msgs</span>[<span class="variable">type</span>];314+ <span class="keyword">return</span> <span class="variable">arr</span> || [];315+ } <span class="keyword">else</span> {316+ <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> = {};317+ <span class="keyword">return</span> <span class="variable">msgs</span>;318+ }319+};320+321+<span class="comment">// Callback for isXMLHttpRequest / xhr</span>322+323+<span class="keyword">function</span> <span class="variable">isxhr</span>() {324+ <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">header</span>(<span class="string">'X-Requested-With'</span>, <span class="string">''</span>).<span class="variable">toLowerCase</span>() === <span class="string">'xmlhttprequest'</span>;325+}</code></pre>326+</td>327+</tr>328+<tr class="code">329+<td class="docs">330+<p>Check if the request was an <em>XMLHttpRequest</em>.</p>331+332+<h2></h2>333+334+<ul><li><p><strong>return</strong>: <em>Boolean</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>335+</td>336+<td class="code">337+<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'isXMLHttpRequest'</span>, <span class="variable">isxhr</span>);338+<span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'xhr'</span>, <span class="variable">isxhr</span>);</code></pre>339+</td>340 </tr><tr class="filename"><td><h2 id="lib/express/response.js"><a href="#">response</a></h2></td><td>lib/express/response.js</td></tr><tr class="code">341 <td class="docs">342 <p>Module dependencies.343 </p>448 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>610-</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">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">612-<p>Module dependencies.613- </p>614-</td>615-<td class="code">616-<pre><code><span class="keyword">var</span> <span class="variable">http</span> = <span class="variable">require</span>(<span class="string">'http'</span>),617- <span class="variable">utils</span> = <span class="variable">require</span>(<span class="string">'./utils'</span>),618- <span class="variable">mime</span> = <span class="variable">require</span>(<span class="string">'connect/utils'</span>).<span class="variable">mime</span>;</code></pre>619-</td>620-</tr>621-<tr class="code">622-<td class="docs">623-<p>Return request header or optional default.</p>798+<p>Parse mini markdown implementation.799+The following conversions are supported,800+primarily for the "flash" middleware:</p>801 625-<h2>Examples</h2>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 627-<pre><code>req.header('Content-Type');628-// => "text/plain"629-630-req.header('content-type');631-// => "text/plain"632-633-req.header('Accept');634-// => undefined635-636-req.header('Accept', 'text/html');637-// => "text/html"</code></pre>638-806 <h2></h2>807 641-<ul><li><p><strong>param</strong>: <em>String</em> name</p></li><li><p><strong>param</strong>: <em>String</em> defaultValue</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>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">644-<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">header</span> = <span class="keyword">function</span>(<span class="variable">name</span>, <span class="variable">defaultValue</span>){645- <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">headers</span>[<span class="variable">name</span>.<span class="variable">toLowerCase</span>()] || <span class="variable">defaultValue</span>;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">651-<p>Check if the <em>Accept</em> header is present, and includes the given <code>type</code>.</p>821+<p>Escape special characters in the given string of html.</p>822 653-<p>When the <em>Accept</em> header is not present <code>true</code> is returned. Otherwise654-the given <code>type</code> is matched by an exact match, and then subtypes. You655-may pass the subtype such as "html" which is then converted internally656-to "text/html" using the mime lookup table.</p>657-658-<h2>Examples</h2>659-660-<pre><code>// Accept: text/html661-req.accepts('html');662-// => true663-664-// Accept: text/*; application/json665-req.accepts('html');666-req.accepts('text/html');667-req.accepts('text/plain');668-req.accepts('application/json');669-// => true670-671-req.accepts('image/png');672-req.accepts('png');673-// => false</code></pre>674-823 <h2></h2>824 677-<ul><li><p><strong>param</strong>: <em>String</em> type</p></li><li><p><strong>return</strong>: <em>Boolean</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>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">680-<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">accepts</span> = <span class="keyword">function</span>(<span class="variable">type</span>){681- <span class="keyword">var</span> <span class="variable">accept</span> = <span class="this">this</span>.<span class="variable">header</span>(<span class="string">'Accept'</span>);682- <span class="keyword">if</span> (!<span class="variable">accept</span> || <span class="variable">accept</span> === '*</code></pre>683-</td>684-</tr>685-<tr class="code">686-<td class="docs">687-<p>') {688- return true;689- } else if (type) {690- // Allow "html" vs "text/html" etc691- if (type.indexOf('/') < 0) {692- type = mime.types['.' + type];693- }694- // Check if we have a direct match695- if (accept.indexOf(type) >= 0) {696- return true;697- // Check if we have type/<em>698- } else {699- type = type.split('/')[0] + '/</em>';700- return accept.indexOf(type) >= 0;701- }702- } else {703- return false;704- }705-};</p>706-707-<p>/**708-Return the value of param <code>name</code> when present.</p>709-710-<ul><li>Checks route placeholders, ex: <em>/user/:id</em></li><li>Checks query string params, ex: ?id=12</li><li>Checks urlencoded body params, ex: id=12</li></ul>711-712-<p>To utilize urlencoded request bodies, <code>req.body</code>713-should be an object. This can be done by using714-the <code>connect.bodyDecoder</code> middleware.</p>715-716-<h2></h2>717-718-<ul><li><p><strong>param</strong>: <em>String</em> name</p></li><li><p><strong>return</strong>: <em>String</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>719-</td>720-<td class="code">721-<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">param</span> = <span class="keyword">function</span>(<span class="variable">name</span>){722- <span class="comment">// Route params like /user/:id</span>723- <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {724- <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">path</span>[<span class="variable">name</span>]; 725- }726- <span class="comment">// Query string params</span>727- <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {728- <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">params</span>.<span class="variable">get</span>[<span class="variable">name</span>]; 729- }730- <span class="comment">// Request body params via connect.bodyDecoder</span>731- <span class="keyword">if</span> (<span class="this">this</span>.<span class="variable">body</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>] !== <span class="variable">undefined</span>) {732- <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">body</span>[<span class="variable">name</span>];733- }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>736-</tr>737-<tr class="code">738-<td class="docs">739-<p>Queue flash <code>msg</code> of the given <code>type</code>.</p>740-741-<h2>Examples</h2>742-743-<pre><code> req.flash('info', 'email sent');744- req.flash('error', 'email delivery failed');745- req.flash('info', 'email re-sent');746- // => 2747-748- req.flash('info');749- // => ['email sent', 'email re-sent']750-751- req.flash('info');752- // => []753-754- req.flash();755- // => { error: ['email delivery failed'], info: [] }</code></pre>756-757-<h2></h2>758-759-<ul><li><p><strong>param</strong>: <em>String</em> type</p></li><li><p><strong>param</strong>: <em>String</em> msg</p></li><li><p><strong>return</strong>: <em>Array | Object | Number</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>760-</td>761-<td class="code">762-<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">flash</span> = <span class="keyword">function</span>(<span class="variable">type</span>, <span class="variable">msg</span>){763- <span class="keyword">var</span> <span class="variable">msgs</span> = <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> = <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> || {};764- <span class="keyword">if</span> (<span class="variable">type</span> &<span class="variable">amp</span>;&<span class="variable">amp</span>; <span class="variable">msg</span>) {765- <span class="variable">msg</span> = <span class="variable">utils</span>.<span class="variable">miniMarkdown</span>(<span class="variable">utils</span>.<span class="variable">htmlEscape</span>(<span class="variable">msg</span>));766- <span class="keyword">return</span> (<span class="variable">msgs</span>[<span class="variable">type</span>] = <span class="variable">msgs</span>[<span class="variable">type</span>] || []).<span class="variable">push</span>(<span class="variable">msg</span>);767- } <span class="keyword">else</span> <span class="keyword">if</span> (<span class="variable">type</span>) {768- <span class="keyword">var</span> <span class="variable">arr</span> = <span class="variable">msgs</span>[<span class="variable">type</span>];769- <span class="keyword">delete</span> <span class="variable">msgs</span>[<span class="variable">type</span>];770- <span class="keyword">return</span> <span class="variable">arr</span> || [];771- } <span class="keyword">else</span> {772- <span class="this">this</span>.<span class="variable">session</span>.<span class="variable">flash</span> = {};773- <span class="keyword">return</span> <span class="variable">msgs</span>;774- }775-};776-777-<span class="comment">// Callback for isXMLHttpRequest / xhr</span>778-779-<span class="keyword">function</span> <span class="variable">isxhr</span>() {780- <span class="keyword">return</span> <span class="this">this</span>.<span class="variable">header</span>(<span class="string">'X-Requested-With'</span>, <span class="string">''</span>).<span class="variable">toLowerCase</span>() === <span class="string">'xmlhttprequest'</span>;781-}</code></pre>782-</td>783-</tr>784-<tr class="code">785-<td class="docs">786-<p>Check if the request was an <em>XMLHttpRequest</em>.</p>787-788-<h2></h2>789-790-<ul><li><p><strong>return</strong>: <em>Boolean</em> </p></li><li><p><strong>api</strong>: <em>public</em></p></li></ul>791-</td>792-<td class="code">793-<pre><code><span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'isXMLHttpRequest'</span>, <span class="variable">isxhr</span>);794-<span class="variable">http</span>.<span class="class">IncomingMessage</span>.<span class="variable">prototype</span>.<span class="variable">__defineGetter__</span>(<span class="string">'xhr'</span>, <span class="variable">isxhr</span>);</code></pre>795-</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>210 unmodified lines1050 }1051 };1052 </code></pre>1053 </td>1014-</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">1015-<td class="docs">1016-<p>Parse mini markdown implementation.1017-The following conversions are supported,1018-primarily for the "flash" middleware:</p>1019-1020-<p> <em>foo</em> or <em>foo</em> become <em>foo</em>1021- <strong>foo</strong> or <strong>foo</strong> become <strong>foo</strong>1022- <a href="B">A</a> becomes <a href="B">A</a></p>1023-1024-<h2></h2>1025-1026-<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>1027-</td>1028-<td class="code">1029-<pre><code><span class="variable">exports</span>.<span class="variable">miniMarkdown</span> = <span class="keyword">function</span>(<span class="variable">str</span>){1030- <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">str</span>)1031- .<span class="variable">replace</span>(<span class="regexp">/(__|\*\*)(.*?)\1/g</span>, <span class="string">'<strong>$2</strong>'</span>)1032- .<span class="variable">replace</span>(<span class="regexp">/(_|\*)(.*?)\1/g</span>, <span class="string">'<em>$2</em>'</span>)1033- .<span class="variable">replace</span>(<span class="regexp">/\[([^\]]+)\]\(([^)]+)\)/g</span>, <span class="string">'<a href="$2">$1</a>'</span>);1034-};</code></pre>1035-</td>1036-</tr>1037-<tr class="code">1038-<td class="docs">1039-<p>Escape special characters in the given string of html.</p>1040-1041-<h2></h2>1042-1043-<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>1044-</td>1045-<td class="code">1046-<pre><code><span class="variable">exports</span>.<span class="variable">htmlEscape</span> = <span class="keyword">function</span>(<span class="variable">html</span>) {1047- <span class="keyword">return</span> <span class="class">String</span>(<span class="variable">html</span>)1048- .<span class="variable">replace</span>(<span class="regexp">/&/g</span>, <span class="string">'&'</span>)1049- .<span class="variable">replace</span>(<span class="regexp">/"/g</span>, <span class="string">'"'</span>)1050- .<span class="variable">replace</span>(<span class="regexp">/</g</span>, <span class="string">'<'</span>)1051- .<span class="variable">replace</span>(<span class="regexp">/>/g</span>, <span class="string">'>'</span>);1052-};</code></pre>1053-</td>1054 </tr> </body>1055 </html></tbody></table>modified:docs/guide.1+1 added-1 removed
122 unmodified lines123 .IP "\(bu" 4124 \fIview engine\fR Default view engine name for views rendered without extensions125 .126 .IP "\(bu" 4127-\fIreload views\fR Reloads altered views, by default watches for \fImtime\fR changes with with a 5 minute interval\. Example: \fBapp\.set(\'reload views\', { interval: 60000 });\fR127+\fIreload views\fR Reloads altered views, by default watches for \fImtime\fR changes with with a 5 minute interval\. Example: \fIapp\.set(\'reload views\', 60000);\fR128 .129 .IP "" 0130 .131 .SS "Routing"403 unmodified linesmodified:docs/guide.html+1 added-1 removed
276 unmodified lines277 <li><em>home</em> Application base path used with <em>res.redirect()</em></li>278 <li><em>views</em> Root views directory defaulting to <strong>CWD/views</strong></li>279 <li><em>view engine</em> Default view engine name for views rendered without extensions</li>280 <li><em>reload views</em> Reloads altered views, by default watches for <em>mtime</em> changes with281- with a 5 minute interval. Example: <code>app.set('reload views', { interval: 60000 });</code></li>281+ with a 5 minute interval. Example: <em>app.set('reload views', 60000);</em></li>282 </ul>283 284 285 <h3 id="Routing">Routing</h3>282 unmodified linesmodified:docs/guide.md+1 added-1 removed
70 unmodified lines71 * _home_ Application base path used with _res.redirect()_72 * _views_ Root views directory defaulting to **CWD/views**73 * _view engine_ Default view engine name for views rendered without extensions74 * _reload views_ Reloads altered views, by default watches for _mtime_ changes with75- with a 5 minute interval. Example: `app.set('reload views', { interval: 60000 });`75+ with a 5 minute interval. Example: _app.set('reload views', 60000);_76 77 ### Routing78 79 Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.250 unmodified lines