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);
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
|
||||
@ -161,6 +160,11 @@ function main() {
|
||||
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) {
|
||||
console.log( jsdoc.opts.parser.help() );
|
||||
exit(0);
|
||||
|
||||
@ -221,6 +221,7 @@
|
||||
setDocletNameToValue(doclet, tag);
|
||||
}
|
||||
})
|
||||
.synonym('func')
|
||||
.synonym('method');
|
||||
|
||||
dictionary.defineTag('global', {
|
||||
@ -332,7 +333,9 @@
|
||||
doclet.type = tag.value.type;
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.synonym('prop')
|
||||
.synonym('var');
|
||||
|
||||
dictionary.defineTag('protected', {
|
||||
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) {
|
||||
@ -110,9 +110,9 @@
|
||||
|
||||
var packageInfo = (data.get( data.find({kind: 'package'}) ) || []) [0];
|
||||
|
||||
function renderLinks(text) {
|
||||
return helper.resolveLinks(text);
|
||||
}
|
||||
//function renderLinks(text) {
|
||||
// return helper.resolveLinks(text);
|
||||
//}
|
||||
|
||||
data.forEach(function(doclet) {
|
||||
doclet.signature = '';
|
||||
@ -146,8 +146,7 @@
|
||||
}
|
||||
else if (doclet.see) {
|
||||
doclet.see.forEach(function(seeItem, i) {
|
||||
doclet.see[i] = urlToLink(seeItem);
|
||||
doclet.see[i] = renderLinks(doclet.see[i]);
|
||||
doclet.see[i] = hashToLink(doclet, seeItem);
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -189,8 +188,8 @@
|
||||
|
||||
// do this after the urls have all been generated
|
||||
data.forEach(function(doclet) {
|
||||
if (doclet.classdesc) doclet.classdesc = renderLinks(doclet.classdesc);
|
||||
if (doclet.description) doclet.description = renderLinks(doclet.description);
|
||||
//if (doclet.classdesc) doclet.classdesc = renderLinks(doclet.classdesc);
|
||||
//if (doclet.description) doclet.description = renderLinks(doclet.description);
|
||||
|
||||
doclet.ancestors = generateAncestry(doclet);
|
||||
});
|
||||
@ -280,16 +279,19 @@
|
||||
var path = outdir + '/' + filename,
|
||||
html = containerTemplate.call(data, data);
|
||||
|
||||
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
|
||||
|
||||
fs.writeFileSync(path, html)
|
||||
}
|
||||
}
|
||||
|
||||
function urlToLink(text) {
|
||||
var replacedText = text.replace(urlToLink.webUrl, '<a href="$1" target="_blank">$1</a>');
|
||||
function hashToLink(doclet, hash) {
|
||||
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;
|
||||
}
|
||||
|
||||
.ancestors { color: #999; }
|
||||
.ancestors a
|
||||
{
|
||||
color: #999 !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.important
|
||||
{
|
||||
font-weight: bold;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: <?js= title ?></title>
|
||||
|
||||
<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/jsdoc-default.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title"><?js= title ?></h1>
|
||||
<h1 class="page-title"><?js= title ?></h1>
|
||||
|
||||
<?js
|
||||
docs.forEach(function(doc, i) {
|
||||
?>
|
||||
|
||||
<section>
|
||||
|
||||
<header>
|
||||
<?js
|
||||
print('<h2>');
|
||||
docs.forEach(function(doc, i) {
|
||||
?>
|
||||
|
||||
if (doc.ancestors && doc.ancestors.length) {
|
||||
print('<span class="ancestors">'+doc.ancestors.join(' » ')+'</span>');
|
||||
print(' » '+doc.name);
|
||||
<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 {
|
||||
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
|
||||
doc.requires.forEach(function(r) {
|
||||
if (doc.augments && doc.augments.length) {
|
||||
?>
|
||||
<li><?js= linkto(r, r) ?></li>
|
||||
<h3 class="subsection-title">Extends</h3>
|
||||
|
||||
<ul><?js
|
||||
doc.augments.forEach(function(a) {
|
||||
?>
|
||||
<li><?js= linkto(a, a) ?></li>
|
||||
<?js
|
||||
});
|
||||
?></ul>
|
||||
<?js
|
||||
});
|
||||
?></ul>
|
||||
<?js
|
||||
}
|
||||
?>
|
||||
|
||||
<?js
|
||||
var classes = 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= linkto(c.longname, c.name) ?></dt>
|
||||
<dd><?js if (c.summary) print(c.summary); ?></dd>
|
||||
|
||||
<?js
|
||||
});
|
||||
?></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) {
|
||||
if (doc.requires && doc.requires.length) {
|
||||
?>
|
||||
<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>
|
||||
<h3 class="subsection-title">Requires</h3>
|
||||
|
||||
<ul><?js
|
||||
doc.requires.forEach(function(r) {
|
||||
?>
|
||||
<li><?js= linkto(r, r) ?></li>
|
||||
<?js
|
||||
});
|
||||
?></ul>
|
||||
<?js
|
||||
});
|
||||
?></dl>
|
||||
}
|
||||
?>
|
||||
|
||||
<?js } ?>
|
||||
<?js
|
||||
var classes = find({kind: 'class', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && classes && classes.length) {
|
||||
?>
|
||||
|
||||
<?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">Classes</h3>
|
||||
|
||||
<h3 class="subsection-title">Properties</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>
|
||||
|
||||
<dl><?js
|
||||
properties.forEach(function(p) {
|
||||
print(render('properties.tmpl', p));
|
||||
});
|
||||
?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?js } ?>
|
||||
<?js
|
||||
var namespaces = find({kind: 'namespace', memberof: doc.longname});
|
||||
if (doc.kind !== 'globalobj' && namespaces && namespaces.length) {
|
||||
?>
|
||||
|
||||
<?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">Namespaces</h3>
|
||||
|
||||
<h3 class="subsection-title">Methods</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>
|
||||
|
||||
<dl><?js
|
||||
methods.forEach(function(m) {
|
||||
print(render('method.tmpl', m));
|
||||
});
|
||||
?></dl>
|
||||
<?js } ?>
|
||||
|
||||
<?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) {
|
||||
?>
|
||||
|
||||
<?js
|
||||
var events = find({kind: 'event', memberof: doc.longname});
|
||||
if (events && events.length && events.forEach) {
|
||||
?>
|
||||
<h3 class="subsection-title">Properties</h3>
|
||||
|
||||
<h3 class="subsection-title">Events</h3>
|
||||
<dl><?js
|
||||
properties.forEach(function(p) {
|
||||
print(render('properties.tmpl', p));
|
||||
});
|
||||
?></dl>
|
||||
|
||||
<dl><?js
|
||||
events.forEach(function(e) {
|
||||
print(render('method.tmpl', e));
|
||||
});
|
||||
?></dl>
|
||||
<?js } ?>
|
||||
</article>
|
||||
<?js } ?>
|
||||
|
||||
</section>
|
||||
<?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>
|
||||
|
||||
<nav>
|
||||
<?js= 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>
|
||||
</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