mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added @var @prop as synonyms for @property. Added configuration for jsVersion, to control the version of JavaScript that is parsable by rhino.
This commit is contained in:
parent
2c38b21159
commit
c6bae386ba
6
jsdoc.js
6
jsdoc.js
@ -129,7 +129,6 @@ function exit(n) {
|
|||||||
java.lang.System.exit(n);
|
java.lang.System.exit(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||||
|
|
||||||
|
|
||||||
@ -161,6 +160,11 @@ function main() {
|
|||||||
env.opts.query = require('query').toObject(env.opts.query);
|
env.opts.query = require('query').toObject(env.opts.query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// which version of javascript will be supported? (rhino only)
|
||||||
|
if (typeof version === 'function') {
|
||||||
|
version(env.conf.jsVersion || 180);
|
||||||
|
}
|
||||||
|
|
||||||
if (env.opts.help) {
|
if (env.opts.help) {
|
||||||
console.log( jsdoc.opts.parser.help() );
|
console.log( jsdoc.opts.parser.help() );
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@ -221,6 +221,7 @@
|
|||||||
setDocletNameToValue(doclet, tag);
|
setDocletNameToValue(doclet, tag);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.synonym('func')
|
||||||
.synonym('method');
|
.synonym('method');
|
||||||
|
|
||||||
dictionary.defineTag('global', {
|
dictionary.defineTag('global', {
|
||||||
@ -332,7 +333,9 @@
|
|||||||
doclet.type = tag.value.type;
|
doclet.type = tag.value.type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.synonym('prop')
|
||||||
|
.synonym('var');
|
||||||
|
|
||||||
dictionary.defineTag('protected', {
|
dictionary.defineTag('protected', {
|
||||||
mustNotHaveValue: true,
|
mustNotHaveValue: true,
|
||||||
|
|||||||
@ -75,7 +75,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
f.signature = (f.signature || '') + '<span class="type-signature">'+htmlsafe(returnTypes.length? ' ⇒ '+returnTypes.join('|') : '')+'</span>';
|
f.signature = (f.signature || '') + '<span class="type-signature">'+htmlsafe(returnTypes.length? ' → {'+returnTypes.join('|')+'}' : '')+'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSignatureType(f) {
|
function addSignatureType(f) {
|
||||||
@ -110,9 +110,9 @@
|
|||||||
|
|
||||||
var packageInfo = (data.get( data.find({kind: 'package'}) ) || []) [0];
|
var packageInfo = (data.get( data.find({kind: 'package'}) ) || []) [0];
|
||||||
|
|
||||||
function renderLinks(text) {
|
//function renderLinks(text) {
|
||||||
return helper.resolveLinks(text);
|
// return helper.resolveLinks(text);
|
||||||
}
|
//}
|
||||||
|
|
||||||
data.forEach(function(doclet) {
|
data.forEach(function(doclet) {
|
||||||
doclet.signature = '';
|
doclet.signature = '';
|
||||||
@ -146,8 +146,7 @@
|
|||||||
}
|
}
|
||||||
else if (doclet.see) {
|
else if (doclet.see) {
|
||||||
doclet.see.forEach(function(seeItem, i) {
|
doclet.see.forEach(function(seeItem, i) {
|
||||||
doclet.see[i] = urlToLink(seeItem);
|
doclet.see[i] = hashToLink(doclet, seeItem);
|
||||||
doclet.see[i] = renderLinks(doclet.see[i]);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -189,8 +188,8 @@
|
|||||||
|
|
||||||
// do this after the urls have all been generated
|
// do this after the urls have all been generated
|
||||||
data.forEach(function(doclet) {
|
data.forEach(function(doclet) {
|
||||||
if (doclet.classdesc) doclet.classdesc = renderLinks(doclet.classdesc);
|
//if (doclet.classdesc) doclet.classdesc = renderLinks(doclet.classdesc);
|
||||||
if (doclet.description) doclet.description = renderLinks(doclet.description);
|
//if (doclet.description) doclet.description = renderLinks(doclet.description);
|
||||||
|
|
||||||
doclet.ancestors = generateAncestry(doclet);
|
doclet.ancestors = generateAncestry(doclet);
|
||||||
});
|
});
|
||||||
@ -279,17 +278,20 @@
|
|||||||
|
|
||||||
var path = outdir + '/' + filename,
|
var path = outdir + '/' + filename,
|
||||||
html = containerTemplate.call(data, data);
|
html = containerTemplate.call(data, data);
|
||||||
|
|
||||||
|
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
||||||
|
|
||||||
fs.writeFileSync(path, html)
|
fs.writeFileSync(path, html)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlToLink(text) {
|
function hashToLink(doclet, hash) {
|
||||||
var replacedText = text.replace(urlToLink.webUrl, '<a href="$1" target="_blank">$1</a>');
|
if ( !/^(#.+)/.test(hash) ) { return hash; }
|
||||||
|
|
||||||
return replacedText
|
var url = helper.createLink(doclet);
|
||||||
|
|
||||||
|
url = url.replace(/(#.+|$)/, hash);
|
||||||
|
return '<a href="'+url+'">'+hash+'</a>';
|
||||||
}
|
}
|
||||||
// looks like a URL starting with http:// or https://
|
|
||||||
urlToLink.webUrl = /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@ -150,6 +150,13 @@ h6
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ancestors { color: #999; }
|
||||||
|
.ancestors a
|
||||||
|
{
|
||||||
|
color: #999 !important;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.important
|
.important
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
<meta charset="utf-8">
|
||||||
<title>JSDoc: <?js= title ?></title>
|
<title>JSDoc: <?js= title ?></title>
|
||||||
|
|
||||||
<script src="http://shjs.sourceforge.net/sh_main.min.js"> </script>
|
<script src="http://shjs.sourceforge.net/sh_main.min.js"> </script>
|
||||||
@ -9,198 +9,199 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="styles/node-dark.css">
|
<link type="text/css" rel="stylesheet" href="styles/node-dark.css">
|
||||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
<h1 class="page-title"><?js= title ?></h1>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
docs.forEach(function(doc, i) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
|
|
||||||
<header>
|
|
||||||
<?js
|
|
||||||
print('<h2>');
|
|
||||||
|
|
||||||
if (doc.ancestors && doc.ancestors.length) {
|
<h1 class="page-title"><?js= title ?></h1>
|
||||||
print('<span class="ancestors">'+doc.ancestors.join(' » ')+'</span>');
|
|
||||||
print(' » '+doc.name);
|
<?js
|
||||||
|
docs.forEach(function(doc, i) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<h2><?js
|
||||||
|
if (doc.ancestors && doc.ancestors.length) {
|
||||||
|
print('<span class="ancestors">');
|
||||||
|
print( doc.ancestors.join(' ⟩ ') );
|
||||||
|
print(' ⟩ </span>' + doc.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print(doc.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doc.variation) {
|
||||||
|
print('<sup>'+doc.variation+'</sup>');
|
||||||
|
}
|
||||||
|
|
||||||
|
?></h2>
|
||||||
|
<?js
|
||||||
|
if (doc.classdesc) {
|
||||||
|
print('<p class="class-description">'+doc.classdesc+'</p>');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<article>
|
||||||
|
<?js
|
||||||
|
if (doc.kind === 'module' && doc.module) {
|
||||||
|
print(render('method.tmpl', doc.module));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doc.kind === 'class') {
|
||||||
|
print(render('method.tmpl', doc));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print(doc.name)
|
if (doc.description) {
|
||||||
|
print('<p class="description">' + doc.description + '</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
print(render('details.tmpl', doc));
|
||||||
|
|
||||||
|
if (doc.examples && doc.examples.length) {
|
||||||
|
print('<h3>Example' + (doc.examples.length > 1? 's':'') + '</h3>');
|
||||||
|
print( render('examples.tmpl', doc.examples) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.variation) {
|
|
||||||
print('<sup>'+doc.variation+'</sup>');
|
|
||||||
}
|
|
||||||
|
|
||||||
print('</h2>');
|
|
||||||
|
|
||||||
if (doc.classdesc) {
|
|
||||||
print('<p class="class-description">'+doc.classdesc+'</p>');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<?js
|
|
||||||
if (doc.kind === 'module' && doc.module) {
|
|
||||||
print(render('method.tmpl', doc.module));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.kind === 'class') {
|
|
||||||
print(render('method.tmpl', doc));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (doc.description) {
|
|
||||||
print('<p class="description">' + doc.description + '</p>');
|
|
||||||
}
|
|
||||||
|
|
||||||
print(render('details.tmpl', doc));
|
|
||||||
|
|
||||||
if (doc.examples && doc.examples.length) {
|
|
||||||
print('<h3>Example' + (doc.examples.length > 1? 's':'') + '</h3>');
|
|
||||||
print( render('examples.tmpl', doc.examples) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
if (doc.augments && doc.augments.length) {
|
|
||||||
?>
|
|
||||||
<h3 class="subsection-title">Extends</h3>
|
|
||||||
|
|
||||||
<ul><?js
|
|
||||||
doc.augments.forEach(function(a) {
|
|
||||||
?>
|
?>
|
||||||
<li><?js= linkto(a, a) ?></li>
|
|
||||||
<?js
|
|
||||||
});
|
|
||||||
?></ul>
|
|
||||||
<?js
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
if (doc.requires && doc.requires.length) {
|
|
||||||
?>
|
|
||||||
<h3 class="subsection-title">Requires</h3>
|
|
||||||
|
|
||||||
<ul><?js
|
<?js
|
||||||
doc.requires.forEach(function(r) {
|
if (doc.augments && doc.augments.length) {
|
||||||
?>
|
?>
|
||||||
<li><?js= linkto(r, r) ?></li>
|
<h3 class="subsection-title">Extends</h3>
|
||||||
<?js
|
|
||||||
});
|
<ul><?js
|
||||||
?></ul>
|
doc.augments.forEach(function(a) {
|
||||||
<?js
|
?>
|
||||||
}
|
<li><?js= linkto(a, a) ?></li>
|
||||||
?>
|
<?js
|
||||||
|
});
|
||||||
<?js
|
?></ul>
|
||||||
var classes = find({kind: 'class', memberof: doc.longname});
|
<?js
|
||||||
if (doc.kind !== 'globalobj' && classes && classes.length) {
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
<h3 class="subsection-title">Classes</h3>
|
|
||||||
|
|
||||||
<dl><?js
|
|
||||||
classes.forEach(function(c) {
|
|
||||||
?>
|
?>
|
||||||
<dt><?js= linkto(c.longname, c.name) ?></dt>
|
|
||||||
<dd><?js if (c.summary) print(c.summary); ?></dd>
|
|
||||||
<?js
|
<?js
|
||||||
});
|
if (doc.requires && doc.requires.length) {
|
||||||
?></dl>
|
|
||||||
|
|
||||||
<?js } ?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
var namespaces = 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= linkto(n.longname, n.name) ?></a></dt>
|
<h3 class="subsection-title">Requires</h3>
|
||||||
<dd><?js if (n.summary) print(n.summary); ?></dd>
|
|
||||||
|
<ul><?js
|
||||||
|
doc.requires.forEach(function(r) {
|
||||||
|
?>
|
||||||
|
<li><?js= linkto(r, r) ?></li>
|
||||||
|
<?js
|
||||||
|
});
|
||||||
|
?></ul>
|
||||||
|
<?js
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<?js
|
<?js
|
||||||
});
|
var classes = find({kind: 'class', memberof: doc.longname});
|
||||||
?></dl>
|
if (doc.kind !== 'globalobj' && classes && classes.length) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">Classes</h3>
|
||||||
|
|
||||||
|
<dl><?js
|
||||||
|
classes.forEach(function(c) {
|
||||||
|
?>
|
||||||
|
<dt><?js= linkto(c.longname, c.name) ?></dt>
|
||||||
|
<dd><?js if (c.summary) print(c.summary); ?></dd>
|
||||||
|
<?js
|
||||||
|
});
|
||||||
|
?></dl>
|
||||||
|
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
<?js } ?>
|
<?js
|
||||||
|
var namespaces = 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= linkto(n.longname, n.name) ?></a></dt>
|
||||||
|
<dd><?js if (n.summary) print(n.summary); ?></dd>
|
||||||
|
<?js
|
||||||
|
});
|
||||||
|
?></dl>
|
||||||
|
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js
|
||||||
|
var properties = find({kind: 'property', memberof: doc.longname});
|
||||||
|
if (title === 'Globals') {
|
||||||
|
properties = find({kind: 'property', memberof: {isUndefined: true}});
|
||||||
|
}
|
||||||
|
if (properties && properties.length && properties.forEach) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">Properties</h3>
|
||||||
|
|
||||||
|
<dl><?js
|
||||||
|
properties.forEach(function(p) {
|
||||||
|
print(render('properties.tmpl', p));
|
||||||
|
});
|
||||||
|
?></dl>
|
||||||
|
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js
|
||||||
|
var methods = find({kind: 'function', memberof: doc.longname});
|
||||||
|
if (title === 'Globals') {
|
||||||
|
methods = find({kind: 'function', memberof: {isUndefined: true}});
|
||||||
|
}
|
||||||
|
if (methods && methods.length && methods.forEach) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">Methods</h3>
|
||||||
|
|
||||||
|
<dl><?js
|
||||||
|
methods.forEach(function(m) {
|
||||||
|
print(render('method.tmpl', m));
|
||||||
|
});
|
||||||
|
?></dl>
|
||||||
|
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js
|
||||||
|
var events = find({kind: 'event', memberof: doc.longname});
|
||||||
|
if (events && events.length && events.forEach) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h3 class="subsection-title">Events</h3>
|
||||||
|
|
||||||
|
<dl><?js
|
||||||
|
events.forEach(function(e) {
|
||||||
|
print(render('method.tmpl', e));
|
||||||
|
});
|
||||||
|
?></dl>
|
||||||
|
<?js } ?>
|
||||||
|
</article>
|
||||||
|
|
||||||
<?js
|
</section>
|
||||||
var properties = find({kind: 'property', memberof: doc.longname});
|
<?js }); ?>
|
||||||
if (title === 'Globals') {
|
|
||||||
properties = find({kind: 'property', memberof: {isUndefined: true}});
|
|
||||||
}
|
|
||||||
if (properties && properties.length && properties.forEach) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h3 class="subsection-title">Properties</h3>
|
|
||||||
|
|
||||||
<dl><?js
|
|
||||||
properties.forEach(function(p) {
|
|
||||||
print(render('properties.tmpl', p));
|
|
||||||
});
|
|
||||||
?></dl>
|
|
||||||
|
|
||||||
<?js } ?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
var methods = find({kind: 'function', memberof: doc.longname});
|
|
||||||
if (title === 'Globals') {
|
|
||||||
methods = find({kind: 'function', memberof: {isUndefined: true}});
|
|
||||||
}
|
|
||||||
if (methods && methods.length && methods.forEach) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h3 class="subsection-title">Methods</h3>
|
|
||||||
|
|
||||||
<dl><?js
|
|
||||||
methods.forEach(function(m) {
|
|
||||||
print(render('method.tmpl', m));
|
|
||||||
});
|
|
||||||
?></dl>
|
|
||||||
|
|
||||||
<?js } ?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
var events = find({kind: 'event', memberof: doc.longname});
|
|
||||||
if (events && events.length && events.forEach) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
<h3 class="subsection-title">Events</h3>
|
|
||||||
|
|
||||||
<dl><?js
|
|
||||||
events.forEach(function(e) {
|
|
||||||
print(render('method.tmpl', e));
|
|
||||||
});
|
|
||||||
?></dl>
|
|
||||||
<?js } ?>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<?js }); ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?js= nav ?>
|
<?js= nav ?>
|
||||||
</nav>
|
</nav>
|
||||||
<br clear="both">
|
|
||||||
<footer>
|
|
||||||
Documentation generated by JSDoc 3 on <?js= (new Date()) ?>
|
|
||||||
</footer>
|
|
||||||
<script> sh_highlightDocument(); </script>
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
Documentation generated by <a href="https://github.com/micmath/jsdoc">JSDoc 3</a> on <?js= (new Date()) ?>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script> sh_highlightDocument(); </script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
5
test/cases/destructuring.js
Normal file
5
test/cases/destructuring.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
A builder function for the Stick application;
|
||||||
|
@var {function} Application
|
||||||
|
*/
|
||||||
|
var {Application} = require("stick");
|
||||||
Loading…
x
Reference in New Issue
Block a user