1293 lines
29 KiB
HTML
1293 lines
29 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'>HamlCoffee</span>
|
|
</div>
|
|
</div>
|
|
<div id='content'>
|
|
<h1>
|
|
Class:
|
|
HamlCoffee
|
|
</h1>
|
|
<table class='box'>
|
|
<tr>
|
|
<td>Defined in:</td>
|
|
<td>node_modules/grunt-codo/node_modules/codo/node_modules/haml-coffee/src/haml-coffee.coffee</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Overview</h2>
|
|
<div class='docstring'>
|
|
<p>The HamlCoffee class is the compiler that parses the source code and creates an syntax tree.
|
|
In a second step the created tree can be rendered into either a JavaScript function or a
|
|
CoffeeScript template.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
<h2>Variables Summary</h2>
|
|
<dl class='constants'>
|
|
<dt id='VERSION-variable'>
|
|
VERSION
|
|
=
|
|
</dt>
|
|
<dd>
|
|
<pre><code class='coffeescript'>require('../package.json')</code></pre>
|
|
<div class='docstring'>
|
|
<p>The current version number.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</dd>
|
|
</dl>
|
|
<h2>Instance Method Summary</h2>
|
|
<ul class='summary'>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#indentChanged-dynamic'>
|
|
#
|
|
(Boolean)
|
|
<b>indentChanged</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Test if the indention level has changed, either increased or decreased.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#isIndent-dynamic'>
|
|
#
|
|
(Boolean)
|
|
<b>isIndent</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Test if the indention levels has been increased.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#updateTabSize-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateTabSize</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Calculate the indention size
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#updateBlockLevel-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateBlockLevel</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Update the current block level indention.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#updateCodeBlockLevel-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateCodeBlockLevel</b><span>(node)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Update the indention level for a code block.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#updateParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateParent</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Update the parent node.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#pushParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>pushParent</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
<p>Indention level has been increased: Push the current parent node to the stack and make
|
|
the current node the parent node.</p>
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#popParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>popParent</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Indention level has been decreased: Make the grand parent the current parent.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#getNodeOptions-dynamic'>
|
|
#
|
|
(Object)
|
|
<b>getNodeOptions</b><span>(override = {})</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Get the options for creating a node
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#nodeFactory-dynamic'>
|
|
#
|
|
(Node)
|
|
<b>nodeFactory</b><span>(expression = '')</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Get the matching node type for the given expression.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#parse-dynamic'>
|
|
#
|
|
(void)
|
|
<b>parse</b><span>(source = '')</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Parse the given source and create the nested node structure.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#evaluate-dynamic'>
|
|
#
|
|
(void)
|
|
<b>evaluate</b><span>(node)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Evaluate the parsed tree
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#render-dynamic'>
|
|
#
|
|
(void)
|
|
<b>render</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Render the parsed source code as CoffeeScript template.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#renderStandalone-dynamic'>
|
|
#
|
|
(void)
|
|
<b>renderStandalone</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Render a standalone version
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#renderAmd-dynamic'>
|
|
#
|
|
(String)
|
|
<b>renderAmd</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='note private title'>Private</span>
|
|
<span class='desc'>
|
|
Render the parsed source code as CoffeeScript template wrapped in a define() statement for AMD.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#renderGlobal-dynamic'>
|
|
#
|
|
(String)
|
|
<b>renderGlobal</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='note private title'>Private</span>
|
|
<span class='desc'>
|
|
Render the parsed source code as CoffeeScript template to a global window.HAML variable.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#precompile-dynamic'>
|
|
#
|
|
(String)
|
|
<b>precompile</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Pre-compiles the parsed source and generates the function source code.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#createCode-dynamic'>
|
|
#
|
|
(String)
|
|
<b>createCode</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Create the CoffeeScript code for the template.
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#getBuffer-dynamic'>
|
|
#
|
|
(void)
|
|
<b>getBuffer</b><span>(level)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Get the code buffer identifer
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#combineText-dynamic'>
|
|
#
|
|
(Array<Object>)
|
|
<b>combineText</b><span>(lines)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Optimize the lines to be rendered by combining subsequent text nodes that are on the same code line indention into a single line.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#convertBooleans-dynamic'>
|
|
#
|
|
(String)
|
|
<b>convertBooleans</b><span>(code)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Adds a boolean convert logic that changes boolean attribute values depending on the output format.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#removeEmptyIDAndClass-dynamic'>
|
|
#
|
|
(String)
|
|
<b>removeEmptyIDAndClass</b><span>(code)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Remove empty ID and class attribute from the final template.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#cleanupWhitespace-dynamic'>
|
|
#
|
|
(String)
|
|
<b>cleanupWhitespace</b><span>(code)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Adds whitespace cleanup function when needed by the template.
|
|
|
|
</span>
|
|
</li>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#findDependencies-dynamic'>
|
|
#
|
|
(Object)
|
|
<b>findDependencies</b><span>(code)</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Searches for AMD require statements to find all template dependencies.
|
|
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
<h2>Constructor Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='constructor-dynamic'>
|
|
#
|
|
(void)
|
|
<b>constructor</b><span>(options = {})</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Construct the HAML Coffee compiler.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>options</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the compiler options </span>
|
|
</li>
|
|
</ul>
|
|
<h3>
|
|
Options Hash:
|
|
(options):
|
|
</h3>
|
|
<ul class='options'>
|
|
<li>
|
|
<span class='name'>placement</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>where to place the resultant function </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>dependencies</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Array<String></tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>dependencies for the amd module </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>escapeHtml</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>escape the output when true </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>escapeAttributes</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>escape the tag attributes when true </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>cleanValue</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>clean CoffeeScript values before inserting </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>uglify</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>don't indent generated HTML when true </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>basename</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>ignore file path when generate the template name </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>extendScope</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>extend the template scope with the context </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>format</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the template format, either <code>xhtml</code>, <code>html4</code> or <code>html5</code> </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>hyphenateDataAttrs</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>whether to convert underscores to hyphens in data attributes </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>preserveTags</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>a comma separated list of tags to preserve content whitespace </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>selfCloseTags</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>a comma separated list of self closing HTML tags </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>customHtmlEscape</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the name of the function for HTML escaping </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>customCleanValue</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the name of the function to clean code insertion values before output </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>customFindAndPreserve</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the name of the function used to find and preserve whitespace </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>customPreserve</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the name of the function used to preserve the whitespace </span>
|
|
</li>
|
|
<li>
|
|
<span class='name'>customReference</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the name of the function used to create the id from object references </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<h2>Instance Method Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='indentChanged-dynamic'>
|
|
#
|
|
(Boolean)
|
|
<b>indentChanged</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Test if the indention level has changed, either
|
|
increased or decreased.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
—
|
|
<span class='desc'>true when indention changed </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='isIndent-dynamic'>
|
|
#
|
|
(Boolean)
|
|
<b>isIndent</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Test if the indention levels has been increased.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Boolean</tt>
|
|
)
|
|
—
|
|
<span class='desc'>true when increased </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='updateTabSize-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateTabSize</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Calculate the indention size</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='updateBlockLevel-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateBlockLevel</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Update the current block level indention.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='updateCodeBlockLevel-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateCodeBlockLevel</b><span>(node)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Update the indention level for a code block.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>node</span>
|
|
<span class='type'>
|
|
(
|
|
<tt><a href='../class/Node.html'>Node</a></tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the node to update </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='updateParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>updateParent</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Update the parent node. This depends on the indention
|
|
if stays the same, goes one down or on up.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='pushParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>pushParent</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Indention level has been increased:
|
|
Push the current parent node to the stack and make
|
|
the current node the parent node.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='popParent-dynamic'>
|
|
#
|
|
(void)
|
|
<b>popParent</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Indention level has been decreased:
|
|
Make the grand parent the current parent.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='getNodeOptions-dynamic'>
|
|
#
|
|
(Object)
|
|
<b>getNodeOptions</b><span>(override = {})</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Get the options for creating a node</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>override</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the options to override </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the node options </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='nodeFactory-dynamic'>
|
|
#
|
|
(Node)
|
|
<b>nodeFactory</b><span>(expression = '')</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Get the matching node type for the given expression. This
|
|
is also responsible for creating the nested tree structure,
|
|
since there is an exception for creating the node tree:
|
|
Within a filter expression, any empty line without indention
|
|
is added as child to the previous filter expression.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>expression</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the HAML expression </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt><a href='../class/Node.html'>Node</a></tt>
|
|
)
|
|
—
|
|
<span class='desc'>the parser node </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='parse-dynamic'>
|
|
#
|
|
(void)
|
|
<b>parse</b><span>(source = '')</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Parse the given source and create the nested node
|
|
structure. This parses the source code line be line, but
|
|
looks ahead to find lines that should be merged into the current line.
|
|
This is needed for splitting Haml attributes over several lines
|
|
and also for the different types of filters.</p><p>Parsing does not create an output, it creates the syntax tree in the
|
|
compiler. To get the template, use <code>#render</code>.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>source</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the HAML source code </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='evaluate-dynamic'>
|
|
#
|
|
(void)
|
|
<b>evaluate</b><span>(node)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Evaluate the parsed tree</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>node</span>
|
|
<span class='type'>
|
|
(
|
|
<tt><a href='../class/Node.html'>Node</a></tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the node to evaluate </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='render-dynamic'>
|
|
#
|
|
(void)
|
|
<b>render</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Render the parsed source code as CoffeeScript template.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='renderStandalone-dynamic'>
|
|
#
|
|
(void)
|
|
<b>renderStandalone</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Render a standalone version</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='renderAmd-dynamic'>
|
|
#
|
|
(String)
|
|
<b>renderAmd</b><span>()</span>
|
|
<span class='note private'>Private</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Render the parsed source code as CoffeeScript template wrapped in a
|
|
define() statement for AMD. If the global modules list contains a module
|
|
that starts with <code>hamlcoffee</code> and is assigned to the <code>hc</code> param, then
|
|
all known helper functions will be taken from the <code>hamlcoffee</code> helper
|
|
module.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the CoffeeScript template source code </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='renderGlobal-dynamic'>
|
|
#
|
|
(String)
|
|
<b>renderGlobal</b><span>()</span>
|
|
<span class='note private'>Private</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Render the parsed source code as CoffeeScript template to a global
|
|
window.HAML variable.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the CoffeeScript template source code </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='precompile-dynamic'>
|
|
#
|
|
(String)
|
|
<b>precompile</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Pre-compiles the parsed source and generates
|
|
the function source code.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the template function source code </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='createCode-dynamic'>
|
|
#
|
|
(String)
|
|
<b>createCode</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Create the CoffeeScript code for the template.</p><p>This gets an array of all lines to be rendered in
|
|
the correct sequence.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the CoffeeScript code </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='getBuffer-dynamic'>
|
|
#
|
|
(void)
|
|
<b>getBuffer</b><span>(level)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Get the code buffer identifer</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>level</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Number</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the block indention level </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='combineText-dynamic'>
|
|
#
|
|
(Array<Object>)
|
|
<b>combineText</b><span>(lines)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Optimize the lines to be rendered by combining subsequent text
|
|
nodes that are on the same code line indention into a single line.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>lines</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>Array<Object></tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the code lines </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Array<Object></tt>
|
|
)
|
|
—
|
|
<span class='desc'>the optimized lines </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='convertBooleans-dynamic'>
|
|
#
|
|
(String)
|
|
<b>convertBooleans</b><span>(code)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Adds a boolean convert logic that changes boolean attribute
|
|
values depending on the output format. This works only when
|
|
the clean value function add a hint marker (\u0093) to each
|
|
boolean value, so that the conversion logic can disinguish
|
|
between dynamic, real boolean values and string values like
|
|
'false' and 'true' or compile time attributes.</p><p>With the XHTML format, an attribute <code>checked='true'</code> will be
|
|
converted to <code>checked='checked'</code> and <code>checked='false'</code> will
|
|
be completely removed.</p><p>With the HTML4 and HTML5 format, an attribute <code>checked='true'</code>
|
|
will be converted to <code>checked</code> and <code>checked='false'</code> will
|
|
be completely removed.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>code</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript template code </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the clean up whitespace code if necessary </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='removeEmptyIDAndClass-dynamic'>
|
|
#
|
|
(String)
|
|
<b>removeEmptyIDAndClass</b><span>(code)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Remove empty ID and class attribute from the
|
|
final template. In case of the ID this is required
|
|
in order to generate valid HTML.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>code</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript template code </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the template code with the code added </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='cleanupWhitespace-dynamic'>
|
|
#
|
|
(String)
|
|
<b>cleanupWhitespace</b><span>(code)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Adds whitespace cleanup function when needed by the
|
|
template. The cleanup must be done AFTER the template
|
|
has been rendered.</p><p>The detection is based on hidden unicode characters that
|
|
are placed as marker into the template:</p><ul>
|
|
<li><code>\u0091</code> Cleanup surrounding whitespace to the left</li>
|
|
<li><code>\u0092</code> Cleanup surrounding whitespace to the right</li>
|
|
</ul>
|
|
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>code</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript template code </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the clean up whitespace code if necessary </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class='method_details'>
|
|
<p class='signature' id='findDependencies-dynamic'>
|
|
#
|
|
(Object)
|
|
<b>findDependencies</b><span>(code)</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Searches for AMD require statements to find
|
|
all template dependencies.</p>
|
|
<div class='examples'>
|
|
<h3>Examples:</h3>
|
|
<h4>
|
|
CST source code
|
|
</h4>
|
|
<pre><code class='coffeescript'>$o.push "" + $c require('assets/templates/test')() => { test: 'assets/templates/test' }</code></pre>
|
|
</div>
|
|
</div>
|
|
<div class='tags'>
|
|
<h3>Parameters:</h3>
|
|
<ul class='param'>
|
|
<li>
|
|
<span class='name'>code</span>
|
|
<span class='type'>
|
|
(
|
|
<tt>String</tt>
|
|
)
|
|
</span>
|
|
—
|
|
<span class='desc'>the CoffeeScript template source code </span>
|
|
</li>
|
|
</ul>
|
|
<h3>Returns:</h3>
|
|
<ul class='return'>
|
|
<li>
|
|
<span class='type'></span>
|
|
(
|
|
<tt>Object</tt>
|
|
)
|
|
—
|
|
<span class='desc'>the module dependencies </span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</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> |