mirror of
https://github.com/Leaflet/Leafdoc.git
synced 2025-07-22 01:23:09 +00:00
174 lines
5.7 KiB
HTML
174 lines
5.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
table {
|
|
border-collapse: collapse;
|
|
}
|
|
table td, table th {
|
|
border: 1px solid #888;
|
|
}
|
|
pre code {
|
|
display: inline-block;
|
|
background: #eee;
|
|
}
|
|
td:last-child code {
|
|
background: #eee;
|
|
}
|
|
body {
|
|
font-family: Sans;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>Leafdoc generated API reference</h2>
|
|
|
|
<h2 id='leafdoc'>Leafdoc</h2>
|
|
<p>Represents the Leafdoc parser</p>
|
|
|
|
<h3 id='leafdoc-example'>Usage example</h3>
|
|
|
|
<section data-type='[object Object]'>
|
|
|
|
|
|
|
|
<p>Output Leafdoc's own documentation to the console with:</p>
|
|
<pre><code>var LeafDoc = require('./src/leafdoc.js');
|
|
var doc = new LeafDoc();
|
|
doc.addDir('src');
|
|
console.log( doc.outputStr() );
|
|
</code></pre>
|
|
|
|
</section>
|
|
|
|
<h3 id='leafdoc-factory'>Creation</h3>
|
|
|
|
<section data-type='[object Object]'>
|
|
|
|
|
|
<table><thead>
|
|
<tr>
|
|
<th>Instantiation</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead><tbody>
|
|
<tr id='leafdoc-leafdoc'>
|
|
<td><code>new <b>Leafdoc</b>(<nobr><Leafdoc options> <i>options</i></nobr>)</nobr></code></td>
|
|
<td>Constructor for a new Leafdoc parser</td>
|
|
</tr>
|
|
</tbody></table>
|
|
</section>
|
|
|
|
<h3 id='leafdoc-option'>Options</h3>
|
|
|
|
<section data-type='[object Object]'>
|
|
|
|
|
|
<table><thead>
|
|
<tr>
|
|
<th>Option</th>
|
|
<th>Type</th>
|
|
<th>Default</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead><tbody>
|
|
<tr id='leafdoc-templatedir'>
|
|
<td><code><b>templateDir</b></code></td>
|
|
<td><code>String </code>
|
|
<td><code>'templates/basic'</code></td>
|
|
<td>Defines which subdirectory (relative to the directory the curent JS
|
|
script is running) holds the handlebars template files for building up the HTML.</td>
|
|
</tr>
|
|
<tr id='leafdoc-showinheritanceswhenempty'>
|
|
<td><code><b>showInheritancesWhenEmpty</b></code></td>
|
|
<td><code>Boolean </code>
|
|
<td><code>false</code></td>
|
|
<td>When <code>true</code>, child classes/namespaces will display documentables from ancestors, even if the child class doesn't have any of such documentables.
|
|
e.g. display inherited events even if the child doesn't define any new events.</td>
|
|
</tr>
|
|
<tr id='leafdoc-leadingcharacter'>
|
|
<td><code><b>leadingCharacter</b></code></td>
|
|
<td><code>String </code>
|
|
<td><code>'🍂'</code></td>
|
|
<td>Overrides the Leaf symbol as the leading character for documentation lines.
|
|
See also <a href="#leafdoc-setleadingcharacter"><code>setLeadingCharacter</code></a>.</td>
|
|
</tr>
|
|
<tr id='leafdoc-customdocumentables'>
|
|
<td><code><b>customDocumentables</b></code></td>
|
|
<td><code>Map </code>
|
|
<td><code>{}</code></td>
|
|
<td>A key-value map. Each pair will be passed to <a href="#leafdoc-registerdocumentable"><code>registerDocumentable</code></a>.</td>
|
|
</tr>
|
|
</tbody></table>
|
|
</section>
|
|
|
|
<h3 id='leafdoc-method'>Methods</h3>
|
|
|
|
<section data-type='[object Object]'>
|
|
|
|
|
|
<table><thead>
|
|
<tr>
|
|
<th>Method</th>
|
|
<th>Returns</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead><tbody>
|
|
<tr id='leafdoc-registerdocumentable'>
|
|
<td><code><b>registerDocumentable</b>(<nobr><String> <i>name</i></nobr>, <nobr><String> <i>label?</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>Registers a new documentable type, beyond the preset ones (function,
|
|
property, etc). New documentable should also not be an already used
|
|
keyword (class, namespace, inherits, etc).
|
|
When registering new documentables, make sure that there is an appropiate
|
|
template file for it.
|
|
Set <code>label</code> to the text for the sections in the generated docs.</td>
|
|
</tr>
|
|
<tr id='leafdoc-setleadingcharacter'>
|
|
<td><code><b>setLeadingCharacter</b>(<nobr><String> <i>char</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>In the rare case you don't want to use 🍂 as the leading character for
|
|
leaf directives, run this function with the desired character, e.g.
|
|
<code>setLeadingCharacter('@');</code>
|
|
The new leading character will apply only to files/dirs/strings parsed from
|
|
that moment on, so it's a good idea to call this before anything else.</td>
|
|
</tr>
|
|
<tr id='leafdoc-adddir'>
|
|
<td><code><b>addDir</b>(<nobr><String> <i>dirname</i></nobr>, <nobr><String[]> <i>extensions?</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>Recursively scans a directory, and parses any files that match the
|
|
given <code>extensions</code> (by default <code>.js</code> and <code>.leafdoc</code>, mind the dots).
|
|
Files with a <code>.leafdoc</code> extension will be treated as leafdoc-only
|
|
instead of source.</td>
|
|
</tr>
|
|
<tr id='leafdoc-addfile'>
|
|
<td><code><b>addFile</b>(<nobr><String> <i>filename</i></nobr>, <nobr><Boolean> <i>isSource?</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>Parses the given file using <a href="#leafdoc-addbuffer"><code>addBuffer</code></a>.</td>
|
|
</tr>
|
|
<tr id='leafdoc-addbuffer'>
|
|
<td><code><b>addBuffer</b>(<nobr><Buffer> <i>buf</i></nobr>, <nobr><Boolean> <i>isSource?</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>Parses the given buffer using <a href="#leafdoc-addstr"><code>addStr</code></a> underneath.</td>
|
|
</tr>
|
|
<tr id='leafdoc-addstr'>
|
|
<td><code><b>addStr</b>(<nobr><String> <i>str</i></nobr>, <nobr><Boolean> <i>isSource?</i></nobr>, <nobr><bar"> <i>foo</i></nobr>)</nobr></code></td>
|
|
<td><code>this</code></td>
|
|
<td>Parses the given string for Leafdoc comments. The string is assumed to
|
|
be source code with comments, unless <code>isSource</code> is explicitly set to <code>false</code>.
|
|
directive.</td>
|
|
</tr>
|
|
<tr id='leafdoc-outputstr'>
|
|
<td><code><b>outputStr</b>()</nobr></code></td>
|
|
<td><code>String</code></td>
|
|
<td>Outputs the documentation to a string.
|
|
Use only after all the needed files have been parsed.</td>
|
|
</tr>
|
|
</tbody></table>
|
|
</section>
|
|
|
|
|
|
|
|
</body></html> |