399 lines
9.0 KiB
HTML
399 lines
9.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<title>CoffeeScript API Documentation</title>
|
|
<script src='../javascript/application.js'></script>
|
|
<script src='../javascript/search.js'></script>
|
|
<link rel='stylesheet' href='../stylesheets/application.css' type='text/css'>
|
|
</head>
|
|
<body>
|
|
<div id='base' data-path='../'></div>
|
|
<div id='header'>
|
|
<div id='menu'>
|
|
<a href='../extra/README.md.html' title='Yatta'>
|
|
Yatta
|
|
</a>
|
|
»
|
|
<a href='../alphabetical_index.html' title='Index'>
|
|
Index
|
|
</a>
|
|
»
|
|
<span class='title'>Traverser</span>
|
|
</div>
|
|
</div>
|
|
<div id='content'>
|
|
<h1>
|
|
Class:
|
|
Traverser
|
|
</h1>
|
|
<table class='box'>
|
|
<tr>
|
|
<td>Defined in:</td>
|
|
<td>node_modules/grunt-codo/node_modules/codo/lib/traverser.coffee</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Overview</h2>
|
|
<div class='docstring'>
|
|
<p>The class takes CS nodes tree and recursively injects
|
|
additional meta-data into it:</p><ol>
|
|
<li>For each possible node it tries every registered
|
|
entity and pushes an instance of it into tree if it suites. 2. For every suitable node it finds the suitable comment block
|
|
respecting things like <code>this.</code> and <code>module.exports =</code> and
|
|
links it to the tree as well.</li>
|
|
</ol><p>Since the transformation is happening upside down, nested entities
|
|
can interact with initialized parents (for instance a class can find
|
|
parent class; method can find the class/mixin/file it belongs to).</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
<h2>Class Method Summary</h2>
|
|
<ul class='summary'>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#read-static'>
|
|
.
|
|
(void)
|
|
<b>read</b><span>(file, environment)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#linkAncestors-static'>
|
|
.
|
|
(void)
|
|
<b>linkAncestors</b><span>(node)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Attach each parent to its children, so we are able to traverse the ancestor parse tree.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#convertComments-static'>
|
|
.
|
|
(void)
|
|
<b>convertComments</b><span>(content, closure = false)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Convert the comments to block comments, so they appear in the nodes.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#whitespace-static'>
|
|
.
|
|
(String)
|
|
<b>whitespace</b><span>(n)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Whitespace helper function
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
<h2>Instance Method Summary</h2>
|
|
<ul class='summary'>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#prepare-dynamic'>
|
|
#
|
|
(void)
|
|
<b>prepare</b><span>(node, file, Entity)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#leftTrimBlock-dynamic'>
|
|
#
|
|
(Array<String>)
|
|
<b>leftTrimBlock</b><span>(text)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Detect whitespace on the left and removes the minimum whitespace ammount.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#inspect-dynamic'>
|
|
#
|
|
(void)
|
|
<b>inspect</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
<h2>Class Method Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='read-static'>
|
|
.
|
|
(void)
|
|
<b>read</b><span>(file, environment)</span>
|
|
<br>
|
|
</p>
|
|
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='linkAncestors-static'>
|
|
.
|
|
(void)
|
|
<b>linkAncestors</b><span>(node)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Attach each parent to its children, so we are able
|
|
to traverse the ancestor parse tree. Since the
|
|
parent attribute is already used in the class node,
|
|
the parent is stored as <code>ancestor</code>.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>nodes</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Base</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript nodes </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='convertComments-static'>
|
|
.
|
|
(void)
|
|
<b>convertComments</b><span>(content, closure = false)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Convert the comments to block comments,
|
|
so they appear in the nodes.</p><p>The methods replaces starting # symbols with invisible
|
|
unicode whitespace to keep empty lines formatted.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>content</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript file content </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='whitespace-static'>
|
|
.
|
|
(String)
|
|
<b>whitespace</b><span>(n)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Whitespace helper function</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>n</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Number</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the number of spaces </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the space string </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<h2>Constructor Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='constructor-dynamic'>
|
|
#
|
|
(void)
|
|
<b>constructor</b><span>(path, content, environment)</span>
|
|
<br>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2>Instance Method Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='prepare-dynamic'>
|
|
#
|
|
(void)
|
|
<b>prepare</b><span>(node, file, Entity)</span>
|
|
<br>
|
|
</p>
|
|
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='leftTrimBlock-dynamic'>
|
|
#
|
|
(Array<String>)
|
|
<b>leftTrimBlock</b><span>(text)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Detect whitespace on the left and removes
|
|
the minimum whitespace ammount.</p><p>The method additionally drops invisible UTF
|
|
whitespace introduced by <code>convertComments</code></p><p>This will keep indention for examples intact.</p>
|
|
<div class='examples'>
|
|
<h3>Examples:</h3>
|
|
<h4>
|
|
left trim all lines
|
|
</h4>
|
|
<pre><code class='coffeescript'>leftTrimBlock(['', ' Escape at maximum speed.', '', ' @param (see #move)', ' '])
|
|
=> ['', 'Escape at maximum speed.', '', '@param (see #move)', '']</code></pre>
|
|
</div>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>lines</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Array<String></tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the comment lines </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Array<String></tt>
|
|
)
|
|
—
|
|
<span class='desc'>lines left trimmed lines </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='inspect-dynamic'>
|
|
#
|
|
(void)
|
|
<b>inspect</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id='footer'>
|
|
August 12, 14 06:33:02 by
|
|
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
|
Codo
|
|
</a>
|
|
2.0.9
|
|
✲
|
|
Press H to see the keyboard shortcuts
|
|
✲
|
|
<a href='http://twitter.com/netzpirat' target='_parent'>@netzpirat</a>
|
|
✲
|
|
<a href='http://twitter.com/_inossidabile' target='_parent'>@_inossidabile</a>
|
|
</div>
|
|
<iframe id='search_frame'></iframe>
|
|
<div id='fuzzySearch'>
|
|
<input type='text'>
|
|
<ol></ol>
|
|
</div>
|
|
<div id='help'>
|
|
<p>
|
|
Quickly fuzzy find classes, mixins, methods, file:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>T</span>
|
|
Open fuzzy finder dialog
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
Control the navigation frame:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>L</span>
|
|
Toggle list view
|
|
</li>
|
|
<li>
|
|
<span>C</span>
|
|
Show class list
|
|
</li>
|
|
<li>
|
|
<span>I</span>
|
|
Show mixin list
|
|
</li>
|
|
<li>
|
|
<span>F</span>
|
|
Show file list
|
|
</li>
|
|
<li>
|
|
<span>M</span>
|
|
Show method list
|
|
</li>
|
|
<li>
|
|
<span>E</span>
|
|
Show extras list
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
You can focus and blur the search input:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<span>S</span>
|
|
Focus search input
|
|
</li>
|
|
<li>
|
|
<span>Esc</span>
|
|
Blur search input
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html> |