262 lines
7.4 KiB
HTML
262 lines
7.4 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'>Directive</span>
|
|
</div>
|
|
</div>
|
|
<div id='content'>
|
|
<h1>
|
|
Class:
|
|
Directive
|
|
</h1>
|
|
<table class='box'>
|
|
<tr>
|
|
<td>Defined in:</td>
|
|
<td>node_modules/grunt-codo/node_modules/codo/node_modules/haml-coffee/src/nodes/directive.coffee</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Inherits:</td>
|
|
<td>
|
|
<a href='../class/Node.html'>Node</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h2>Overview</h2>
|
|
<div class='docstring'>
|
|
<p>Directive node for HAML statements that change the meaning or do interact
|
|
uniquely with the HAML document.</p>
|
|
<div class='examples'>
|
|
<h3>Examples:</h3>
|
|
<h4>
|
|
include a HAML document inside of another
|
|
</h4>
|
|
<pre><code class='coffeescript'>+include 'path/to/template'[, context]</code></pre>
|
|
</div>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
<h2>Variables Summary</h2>
|
|
<dl class='constants'>
|
|
<dt id='directives-variable'>
|
|
directives
|
|
=
|
|
</dt>
|
|
<dd>
|
|
<pre><code class='coffeescript'>{
|
|
|
|
/*
|
|
Includes a HAML document inside of the current one. Context included
|
|
template is defaulted to the context of this template but may be changed
|
|
by passing a second argument.
|
|
|
|
@example Include with default context
|
|
+include 'path/to/template'
|
|
|
|
@example Include with custom context
|
|
+include 'path/to/template', @context
|
|
*/
|
|
include: function(expression) {
|
|
var Compiler, code, compiler, context, e, error, name, source, statement, _ref;
|
|
try {
|
|
_ref = expression.match(/\s*['"](.*?)['"](?:,\s*(.*))?\s*/), _ref[0], name = _ref[1], context = _ref[2];
|
|
} catch (_error) {
|
|
e = _error;
|
|
throw new Error("Failed to parse the include directive from " + expression);
|
|
}
|
|
if (!context) {
|
|
context = 'this';
|
|
}
|
|
statement = (function() {
|
|
switch (this.placement) {
|
|
case 'global':
|
|
return "" + this.namespace + "['" + name + "'](" + context + ")";
|
|
case 'amd':
|
|
return "require('" + name + "')(" + context + ")";
|
|
case 'standalone':
|
|
if (typeof browser !== "undefined" && browser !== null ? browser.process : void 0) {
|
|
throw new Error("Include directive not available in the Browser when placement is standalone.");
|
|
} else {
|
|
try {
|
|
source = fs.readFileSync(name).toString();
|
|
} catch (_error) {
|
|
error = _error;
|
|
console.error(" Error opening file: %s", error);
|
|
console.error(error);
|
|
}
|
|
|
|
/*
|
|
Compile and build the source function.
|
|
*/
|
|
Compiler = require('../haml-coffee');
|
|
compiler = new Compiler(this.options);
|
|
compiler.parse(source);
|
|
code = CoffeeScript.compile(compiler.precompile(), {
|
|
bare: true
|
|
});
|
|
return statement = "`(function(){" + code + "}).apply(" + context + ")`";
|
|
}
|
|
break;
|
|
default:
|
|
throw new Error("Include directive not available when placement is " + this.placement);
|
|
}
|
|
}).call(this);
|
|
return this.opener = this.markInsertingCode(statement, false);
|
|
}
|
|
}</code></pre>
|
|
<div class='docstring'>
|
|
<p>Map of available directives to methods.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</div>
|
|
</dd>
|
|
</dl>
|
|
<h3 class='inherited'>
|
|
Variable inherited from
|
|
<a href='../class/Node.html'>Node</a>
|
|
</h3>
|
|
<p class='inherited'>
|
|
<a href='../class/Node.html#CLEAR_WHITESPACE_LEFT-variable'>CLEAR_WHITESPACE_LEFT</a>
|
|
<a href='../class/Node.html#CLEAR_WHITESPACE_RIGHT-variable'>CLEAR_WHITESPACE_RIGHT</a>
|
|
</p>
|
|
<h2>Instance Method Summary</h2>
|
|
<ul class='summary'>
|
|
<li>
|
|
<span class='signature'>
|
|
<a href='#evaluate-dynamic'>
|
|
#
|
|
(void)
|
|
<b>evaluate</b><span>()</span>
|
|
</a>
|
|
</span>
|
|
<span class='desc'>
|
|
Evaluate the Haml directive.
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
<h2>
|
|
<small>Inherited Method Summary</small>
|
|
<h3 class='inherited'>
|
|
Methods inherited from
|
|
<a href='../class/Node.html'>Node</a>
|
|
</h3>
|
|
<p class='inherited'>
|
|
<a href='../class/Node.html#addChild-dynamic'>#addChild</a>
|
|
<a href='../class/Node.html#getOpener-dynamic'>#getOpener</a>
|
|
<a href='../class/Node.html#getCloser-dynamic'>#getCloser</a>
|
|
<a href='../class/Node.html#isPreserved-dynamic'>#isPreserved</a>
|
|
<a href='../class/Node.html#isCommented-dynamic'>#isCommented</a>
|
|
<a href='../class/Node.html#markText-dynamic'>#markText</a>
|
|
<a href='../class/Node.html#markRunningCode-dynamic'>#markRunningCode</a>
|
|
<a href='../class/Node.html#markInsertingCode-dynamic'>#markInsertingCode</a>
|
|
<a href='../class/Node.html#evaluate-dynamic'>#evaluate</a>
|
|
<a href='../class/Node.html#render-dynamic'>#render</a>
|
|
</p>
|
|
</h2>
|
|
<h2>Instance Method Details</h2>
|
|
<div class='methods'>
|
|
<div class='method_details'>
|
|
<p class='signature' id='evaluate-dynamic'>
|
|
#
|
|
(void)
|
|
<b>evaluate</b><span>()</span>
|
|
<br>
|
|
</p>
|
|
<div class='docstring'>
|
|
<p>Evaluate the Haml directive.</p>
|
|
</div>
|
|
<div class='tags'>
|
|
</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> |