Differentiating doc from apidoc
This renames the doc task to apidoc. The apidoc delegates to jsdoc3 currently. We will have additional documentation that is not built by jsdoc3. It makes sense to reserve the more general 'doc' name for building all documentation (not just apidoc).
This commit is contained in:
143
apidoc/template/tmpl/container.tmpl
Normal file
143
apidoc/template/tmpl/container.tmpl
Normal file
@@ -0,0 +1,143 @@
|
||||
<?js
|
||||
var self = this;
|
||||
docs.forEach(function(doc, i) {
|
||||
?>
|
||||
|
||||
<?js if (doc.kind === 'mainpage' || (doc.kind === 'package')) { ?>
|
||||
<?js= self.partial('mainpage.tmpl', doc) ?>
|
||||
<?js } else { ?>
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<h2><?js if (doc.ancestors && doc.ancestors.length) { ?>
|
||||
<span class="ancestors"><?js= doc.ancestors.join('') ?></span>
|
||||
<?js } ?>
|
||||
<?js= doc.longname ?>
|
||||
<?js if (doc.variation) { ?>
|
||||
<sup class="variation"><?js= doc.variation ?></sup>
|
||||
<?js } ?></h2>
|
||||
<?js if (doc.classdesc) { ?>
|
||||
<div class="class-description"><?js= doc.classdesc ?></div>
|
||||
<?js } ?>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<div class="container-overview">
|
||||
<?js if (doc.kind === 'module' && doc.module) { ?>
|
||||
<?js= self.partial('method.tmpl', doc.module) ?>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (doc.kind === 'class') { ?>
|
||||
<?js= self.partial('method.tmpl', doc) ?>
|
||||
<?js } else { ?>
|
||||
<?js if (doc.description) { ?>
|
||||
<div class="description"><?js= doc.description ?></div>
|
||||
<?js } ?>
|
||||
|
||||
<?js= self.partial('details.tmpl', doc) ?>
|
||||
|
||||
<?js if (doc.examples && doc.examples.length) { ?>
|
||||
<h3>Example<?js= doc.examples.length > 1? 's':'' ?></h3>
|
||||
<?js= self.partial('examples.tmpl', doc.examples) ?>
|
||||
<?js } ?>
|
||||
<?js } ?>
|
||||
</div>
|
||||
|
||||
<?js if (doc.augments && doc.augments.length) { ?>
|
||||
<h3 class="subsection-title">Extends</h3>
|
||||
|
||||
<ul><?js doc.augments.forEach(function(a) { ?>
|
||||
<li><?js= self.linkto(a, a) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (doc.mixes && doc.mixes.length) { ?>
|
||||
<h3 class="subsection-title">Mixes In</h3>
|
||||
|
||||
<ul><?js doc.mixes.forEach(function(a) { ?>
|
||||
<li><?js= self.linkto(a, a) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (doc.requires && doc.requires.length) { ?>
|
||||
<h3 class="subsection-title">Requires</h3>
|
||||
|
||||
<ul><?js doc.requires.forEach(function(r) { ?>
|
||||
<li><?js= self.linkto(r, r) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var classes = self.find({kind: 'class', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && classes && classes.length) {
|
||||
?>
|
||||
<h3 class="subsection-title">Classes</h3>
|
||||
|
||||
<dl><?js classes.forEach(function(c) { ?>
|
||||
<dt><?js= self.linkto(c.longname, c.longname) ?></dt>
|
||||
<dd><?js if (c.summary) { ?><?js= c.summary ?><?js } ?></dd>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var namespaces = self.find({kind: 'namespace', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && namespaces && namespaces.length) {
|
||||
?>
|
||||
<h3 class="subsection-title">Namespaces</h3>
|
||||
|
||||
<dl><?js namespaces.forEach(function(n) { ?>
|
||||
<dt><a href="namespaces.html#<?js= n.longname ?>"><?js= self.linkto(n.longname, n.longname) ?></a></dt>
|
||||
<dd><?js if (n.summary) { ?><?js= n.summary ?><?js } ?></dd>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var members = self.find({kind: 'member', memberof: title === 'Globals'? {isUndefined: true} : doc.longname});
|
||||
if (members && members.length && members.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Members</h3>
|
||||
|
||||
<dl><?js members.forEach(function(p) { ?>
|
||||
<?js= self.partial('members.tmpl', p) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var methods = self.find({kind: 'function', memberof: title === 'Globals'? {isUndefined: true} : doc.longname});
|
||||
if (methods && methods.length && methods.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl><?js methods.forEach(function(m) { ?>
|
||||
<?js= self.partial('method.tmpl', m) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var typedefs = self.find({kind: 'typedef', memberof: doc.longname});
|
||||
if (typedefs && typedefs.length && typedefs.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">TypeDefs</h3>
|
||||
|
||||
<dl><?js typedefs.forEach(function(e) { ?>
|
||||
<?js= self.partial('members.tmpl', e) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js
|
||||
var events = self.find({kind: 'event', memberof: doc.longname});
|
||||
if (events && events.length && events.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Events</h3>
|
||||
|
||||
<dl><?js events.forEach(function(e) { ?>
|
||||
<?js= self.partial('method.tmpl', e) ?>
|
||||
<?js }); ?></dl>
|
||||
<?js } ?>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
<?js } ?>
|
||||
|
||||
<?js }); ?>
|
||||
96
apidoc/template/tmpl/details.tmpl
Normal file
96
apidoc/template/tmpl/details.tmpl
Normal file
@@ -0,0 +1,96 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
<dl class="details">
|
||||
<?js
|
||||
var properties = data.properties;
|
||||
if (properties && properties.length && properties.forEach) {
|
||||
?>
|
||||
|
||||
<h5 class="subsection-title">Properties:</h5>
|
||||
|
||||
<dl><?js= this.partial('properties.tmpl', properties) ?></dl>
|
||||
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.version) {?>
|
||||
<dt class="tag-version">Version:</dt>
|
||||
<dd class="tag-version"><ul class="dummy"><li><?js= version ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.since) {?>
|
||||
<dt class="tag-since">Since:</dt>
|
||||
<dd class="tag-since"><ul class="dummy"><li><?js= since ?></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.inherited && data.inherits) { ?>
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
<?js= this.linkto(data.inherits, this.htmlsafe(data.inherits)) ?>
|
||||
</li></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.deprecated) { ?>
|
||||
<dt class="important tag-deprecated">Deprecated:</dt><?js
|
||||
if (data.deprecated === true) { ?><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd><?js }
|
||||
else { ?><dd><ul class="dummy"><li><?js= data.deprecated ?></li><ul></dd><?js }
|
||||
?>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.author && author.length) {?>
|
||||
<dt class="tag-author">Author:</dt>
|
||||
<dd class="tag-author">
|
||||
<ul><?js author.forEach(function(a) { ?>
|
||||
<li><?js= a ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.copyright) {?>
|
||||
<dt class="tag-copyright">Copyright:</dt>
|
||||
<dd class="tag-copyright"><ul class="dummy"><li><?js= copyright ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.license) {?>
|
||||
<dt class="tag-license">License:</dt>
|
||||
<dd class="tag-license"><ul class="dummy"><li><?js= license ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.defaultvalue) {?>
|
||||
<dt class="tag-default">Default Value:</dt>
|
||||
<dd class="tag-default"><ul class="dummy"><li><?js= data.defaultvalue ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.meta) {?>
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li><?js= meta.filename ?>, line <?js= meta.lineno ?></li></ul></dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.tutorials && tutorials.length) {?>
|
||||
<dt class="tag-tutorial">Tutorials:</dt>
|
||||
<dd class="tag-tutorial">
|
||||
<ul><?js tutorials.forEach(function(t) { ?>
|
||||
<li><?js= self.tutoriallink(t) ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.see && see.length) {?>
|
||||
<dt class="tag-see">See:</dt>
|
||||
<dd class="tag-see">
|
||||
<ul><?js see.forEach(function(s) { ?>
|
||||
<li><?js= self.linkto(s) ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.todo && todo.length) {?>
|
||||
<dt class="tag-todo">To Do:</dt>
|
||||
<dd class="tag-todo">
|
||||
<ul><?js todo.forEach(function(t) { ?>
|
||||
<li><?js= t ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
</dl>
|
||||
2
apidoc/template/tmpl/example.tmpl
Normal file
2
apidoc/template/tmpl/example.tmpl
Normal file
@@ -0,0 +1,2 @@
|
||||
<?js var data = obj; ?>
|
||||
<pre><code><?js= data ?></code></pre>
|
||||
11
apidoc/template/tmpl/examples.tmpl
Normal file
11
apidoc/template/tmpl/examples.tmpl
Normal file
@@ -0,0 +1,11 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
data.forEach(function(example) {
|
||||
if (example.caption) {
|
||||
?>
|
||||
<p class="code-caption"><?js= example.caption ?></p>
|
||||
<?js } ?>
|
||||
<pre class="prettyprint"><code><?js= example.code ?></code></pre>
|
||||
<?js
|
||||
});
|
||||
?>
|
||||
19
apidoc/template/tmpl/exceptions.tmpl
Normal file
19
apidoc/template/tmpl/exceptions.tmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
if (data.description) {
|
||||
?>
|
||||
<div class="param-desc">
|
||||
<?js= description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.type && data.type.names) {?>
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
<?js= this.partial('type.tmpl', data.type.names) ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<?js } ?>
|
||||
4
apidoc/template/tmpl/fires.tmpl
Normal file
4
apidoc/template/tmpl/fires.tmpl
Normal file
@@ -0,0 +1,4 @@
|
||||
<?js var data = obj; ?>
|
||||
<li>
|
||||
<?js= data ?>
|
||||
</li>
|
||||
45
apidoc/template/tmpl/layout.tmpl
Normal file
45
apidoc/template/tmpl/layout.tmpl
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>OpenLayers 3 API Documentation - <?js= title ?></title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="./">OpenLayers 3 API Documentation - <?js= title ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<?js= content ?>
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<?js= this.nav ?>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3</a>
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
</body>
|
||||
</html>
|
||||
14
apidoc/template/tmpl/mainpage.tmpl
Normal file
14
apidoc/template/tmpl/mainpage.tmpl
Normal file
@@ -0,0 +1,14 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
|
||||
<?js if (data.kind === 'package') { ?>
|
||||
<h3><?js= data.name ?> <?js= data.version ?></h3>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.readme) { ?>
|
||||
<section>
|
||||
<article><?js= data.readme ?></article>
|
||||
</section>
|
||||
<?js } ?>
|
||||
22
apidoc/template/tmpl/members.tmpl
Normal file
22
apidoc/template/tmpl/members.tmpl
Normal file
@@ -0,0 +1,22 @@
|
||||
<?js var data = obj; ?>
|
||||
<dt class="<?js= data.access ?>">
|
||||
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + name + data.signature ?></h4>
|
||||
|
||||
<?js if (data.summary) { ?>
|
||||
<p class="summary"><?js= summary ?></p>
|
||||
<?js } ?>
|
||||
</dt>
|
||||
<dd class="<?js= data.access ?>">
|
||||
<?js if (data.description) { ?>
|
||||
<div class="description">
|
||||
<?js= data.description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js= this.partial('details.tmpl', data) ?>
|
||||
|
||||
<?js if (data.examples && examples.length) { ?>
|
||||
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
||||
<?js= this.partial('examples.tmpl', examples) ?>
|
||||
<?js } ?>
|
||||
</dd>
|
||||
76
apidoc/template/tmpl/method.tmpl
Normal file
76
apidoc/template/tmpl/method.tmpl
Normal file
@@ -0,0 +1,76 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
?>
|
||||
<dt>
|
||||
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind == 'class'? 'new ':'') + name + data.signature ?></h4>
|
||||
|
||||
<?js if (data.summary) { ?>
|
||||
<p class="summary"><?js= summary ?></p>
|
||||
<?js } ?>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<?js if (data.description) { ?>
|
||||
<div class="description">
|
||||
<?js= data.description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (kind === 'event' && data.type && data.type.names) {?>
|
||||
<h5>Type:</h5>
|
||||
<ul>
|
||||
<li>
|
||||
<?js= self.partial('type.tmpl', data.type.names) ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data['this']) { ?>
|
||||
<h5>This:</h5>
|
||||
<ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.params && params.length) { ?>
|
||||
<h5>Parameters:</h5>
|
||||
<?js= this.partial('params.tmpl', params) ?>
|
||||
<?js } ?>
|
||||
|
||||
<?js= this.partial('details.tmpl', data) ?>
|
||||
|
||||
<?js if (data.fires && fires.length) { ?>
|
||||
<h5>Fires:</h5>
|
||||
<ul><?js fires.forEach(function(f) { ?>
|
||||
<?js= self.partial('fires.tmpl', self.linkto(f) ) ?>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.exceptions && exceptions.length) { ?>
|
||||
<h5>Throws:</h5>
|
||||
<?js if (exceptions.length > 1) { ?><ul><?js
|
||||
exceptions.forEach(function(r) { ?>
|
||||
<li><?js= self.partial('exceptions.tmpl', r) ?></li>
|
||||
<?js });
|
||||
?></ul><?js } else {
|
||||
exceptions.forEach(function(r) { ?>
|
||||
<?js= self.partial('exceptions.tmpl', r) ?>
|
||||
<?js });
|
||||
} } ?>
|
||||
|
||||
<?js if (data.returns && returns.length) { ?>
|
||||
<h5>Returns:</h5>
|
||||
<?js if (returns.length > 1) { ?><ul><?js
|
||||
returns.forEach(function(r) { ?>
|
||||
<li><?js= self.partial('returns.tmpl', r) ?></li>
|
||||
<?js });
|
||||
?></ul><?js } else {
|
||||
returns.forEach(function(r) { ?>
|
||||
<?js= self.partial('returns.tmpl', r) ?>
|
||||
<?js });
|
||||
} } ?>
|
||||
|
||||
<?js if (data.examples && examples.length) { ?>
|
||||
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
||||
<?js= this.partial('examples.tmpl', examples) ?>
|
||||
<?js } ?>
|
||||
</dd>
|
||||
108
apidoc/template/tmpl/params.tmpl
Normal file
108
apidoc/template/tmpl/params.tmpl
Normal file
@@ -0,0 +1,108 @@
|
||||
<?js
|
||||
var params = obj;
|
||||
|
||||
/* sort subparams under their parent params (like opts.classname) */
|
||||
var parentParam = null;
|
||||
params.forEach(function(param, i) {
|
||||
if (!param) { return; }
|
||||
if ( parentParam && param.name && param.name.indexOf(parentParam.name + '.') === 0 ) {
|
||||
param.name = param.name.substr(parentParam.name.length+1);
|
||||
parentParam.subparams = parentParam.subparams || [];
|
||||
parentParam.subparams.push(param);
|
||||
params[i] = null;
|
||||
}
|
||||
else {
|
||||
parentParam = param;
|
||||
}
|
||||
});
|
||||
|
||||
/* determine if we need extra columns, "attributes" and "default" */
|
||||
params.hasAttributes = false;
|
||||
params.hasDefault = false;
|
||||
params.hasName = false;
|
||||
|
||||
params.forEach(function(param) {
|
||||
if (!param) { return; }
|
||||
|
||||
if (param.optional || param.nullable) {
|
||||
params.hasAttributes = true;
|
||||
}
|
||||
|
||||
if (param.name) {
|
||||
params.hasName = true;
|
||||
}
|
||||
|
||||
if (typeof param.defaultvalue !== 'undefined') {
|
||||
params.hasDefault = true;
|
||||
}
|
||||
});
|
||||
?>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<?js if (params.hasName) {?>
|
||||
<th>Name</th>
|
||||
<?js } ?>
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
<?js if (params.hasAttributes) {?>
|
||||
<th>Argument</th>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (params.hasDefault) {?>
|
||||
<th>Default</th>
|
||||
<?js } ?>
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?js
|
||||
var self = this;
|
||||
params.forEach(function(param) {
|
||||
if (!param) { return; }
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<?js if (params.hasName) {?>
|
||||
<td class="name"><code><?js= param.name.replace(/^opt_/, "") ?></code></td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="type">
|
||||
<?js if (param.type && param.type.names) {?>
|
||||
<?js= self.partial('type.tmpl', param.type.names) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
|
||||
<?js if (params.hasAttributes) {?>
|
||||
<td class="attributes">
|
||||
<?js if (param.optional) { ?>
|
||||
<optional><br>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (param.nullable) { ?>
|
||||
<nullable><br>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (params.hasDefault) {?>
|
||||
<td class="default">
|
||||
<?js if (typeof param.defaultvalue !== 'undefined') { ?>
|
||||
<?js= self.htmlsafe(param.defaultvalue) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="description last"><?js= (param.optional ? "(Optional) " : "") + param.description ?><?js if (param.subparams) { ?>
|
||||
<h6>Properties</h6>
|
||||
<?js= self.partial('params.tmpl', param.subparams) ?>
|
||||
<?js } ?></td>
|
||||
</tr>
|
||||
|
||||
<?js }); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
107
apidoc/template/tmpl/properties.tmpl
Normal file
107
apidoc/template/tmpl/properties.tmpl
Normal file
@@ -0,0 +1,107 @@
|
||||
<?js
|
||||
var props = obj;
|
||||
|
||||
/* sort subprops under their parent props (like opts.classname) */
|
||||
var parentProp = null;
|
||||
props.forEach(function(prop, i) {
|
||||
if (!prop) { return; }
|
||||
if ( parentProp && prop.name.indexOf(parentProp.name + '.') === 0 ) {
|
||||
prop.name = prop.name.substr(parentProp.name.length+1);
|
||||
parentProp.subprops = parentProp.subprops || [];
|
||||
parentProp.subprops.push(prop);
|
||||
props[i] = null;
|
||||
}
|
||||
else {
|
||||
parentProp = prop;
|
||||
}
|
||||
});
|
||||
|
||||
/* determine if we need extra columns, "attributes" and "default" */
|
||||
props.hasAttributes = false;
|
||||
props.hasDefault = false;
|
||||
props.hasName = false;
|
||||
|
||||
props.forEach(function(prop) {
|
||||
if (!prop) { return; }
|
||||
|
||||
if (prop.optional || prop.nullable) {
|
||||
props.hasAttributes = true;
|
||||
}
|
||||
|
||||
if (prop.name) {
|
||||
props.hasName = true;
|
||||
}
|
||||
|
||||
if (typeof prop.defaultvalue !== 'undefined') {
|
||||
props.hasDefault = true;
|
||||
}
|
||||
});
|
||||
?>
|
||||
|
||||
<table class="props">
|
||||
<thead>
|
||||
<tr>
|
||||
<?js if (props.hasName) {?>
|
||||
<th>Name</th>
|
||||
<?js } ?>
|
||||
|
||||
<th>Type</th>
|
||||
|
||||
<?js if (props.hasAttributes) {?>
|
||||
<th>Argument</th>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (props.hasDefault) {?>
|
||||
<th>Default</th>
|
||||
<?js } ?>
|
||||
|
||||
<th class="last">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?js
|
||||
var self = this;
|
||||
props.forEach(function(prop) {
|
||||
if (!prop) { return; }
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<?js if (props.hasName) {?>
|
||||
<td class="name"><code><?js= prop.name ?></code></td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="type">
|
||||
<?js if (prop.type && prop.type.names) {?>
|
||||
<?js= self.partial('type.tmpl', prop.type.names) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
|
||||
<?js if (props.hasAttributes) {?>
|
||||
<td class="attributes">
|
||||
<?js if (prop.optional) { ?>
|
||||
<optional><br>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (prop.nullable) { ?>
|
||||
<nullable><br>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (props.hasDefault) {?>
|
||||
<td class="default">
|
||||
<?js if (typeof prop.defaultvalue !== 'undefined') { ?>
|
||||
<?js= self.htmlsafe(prop.defaultvalue) ?>
|
||||
<?js } ?>
|
||||
</td>
|
||||
<?js } ?>
|
||||
|
||||
<td class="description last"><?js= prop.description ?><?js if (prop.subprops) { ?>
|
||||
<h6>Properties</h6><?js= self.partial('properties.tmpl', prop.subprops) ?>
|
||||
<?js } ?></td>
|
||||
</tr>
|
||||
|
||||
<?js }); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
19
apidoc/template/tmpl/returns.tmpl
Normal file
19
apidoc/template/tmpl/returns.tmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
if (data.description) {
|
||||
?>
|
||||
<div class="param-desc">
|
||||
<?js= description ?>
|
||||
</div>
|
||||
<?js } ?>
|
||||
|
||||
<?js if (data.type && data.type.names) {?>
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
<?js= this.partial('type.tmpl', data.type.names) ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<?js } ?>
|
||||
8
apidoc/template/tmpl/source.tmpl
Normal file
8
apidoc/template/tmpl/source.tmpl
Normal file
@@ -0,0 +1,8 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
?>
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source"><code><?js= data.code ?></code></pre>
|
||||
</article>
|
||||
</section>
|
||||
19
apidoc/template/tmpl/tutorial.tmpl
Normal file
19
apidoc/template/tmpl/tutorial.tmpl
Normal file
@@ -0,0 +1,19 @@
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<?js if (children.length > 0) { ?>
|
||||
<ul><?js
|
||||
var self = this;
|
||||
children.forEach(function(t) { ?>
|
||||
<li><?js= self.tutoriallink(t.name) ?></li>
|
||||
<?js }); ?></ul>
|
||||
<?js } ?>
|
||||
|
||||
<h2><?js= header ?></h2>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<?js= content ?>
|
||||
</article>
|
||||
|
||||
</section>
|
||||
7
apidoc/template/tmpl/type.tmpl
Normal file
7
apidoc/template/tmpl/type.tmpl
Normal file
@@ -0,0 +1,7 @@
|
||||
<?js
|
||||
var data = obj;
|
||||
var self = this;
|
||||
data.forEach(function(name, i) { ?>
|
||||
<span class="param-type"><?js= self.linkto(name, self.htmlsafe(name)) ?></span>
|
||||
<?js if (i < data.length-1) { ?>|<?js } ?>
|
||||
<?js }); ?>
|
||||
Reference in New Issue
Block a user