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:
Michael Mathews 2011-08-14 12:35:00 +01:00
parent 2c38b21159
commit c6bae386ba
7 changed files with 213 additions and 190 deletions

View File

@ -9,6 +9,7 @@
}, },
"plugins": [ "plugins": [
] ],
"jsVersion": 180
} }

View File

@ -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);

View File

@ -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,

View File

@ -75,7 +75,7 @@
}); });
} }
f.signature = (f.signature || '') + '<span class="type-signature">'+htmlsafe(returnTypes.length? ' &#8658; '+returnTypes.join('|') : '')+'</span>'; f.signature = (f.signature || '') + '<span class="type-signature">'+htmlsafe(returnTypes.length? ' &rarr; {'+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);
}); });
@ -280,16 +279,19 @@
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
})(); })();

View File

@ -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;

View File

@ -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,7 +9,6 @@
<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>
@ -25,12 +24,11 @@
<section> <section>
<header> <header>
<?js <h2><?js
print('<h2>');
if (doc.ancestors && doc.ancestors.length) { if (doc.ancestors && doc.ancestors.length) {
print('<span class="ancestors">'+doc.ancestors.join(' » ')+'</span>'); print('<span class="ancestors">');
print(' » '+doc.name); print( doc.ancestors.join(' &rang; ') );
print(' &rang; </span>' + doc.name);
} }
else { else {
print(doc.name) print(doc.name)
@ -40,8 +38,8 @@
print('<sup>'+doc.variation+'</sup>'); print('<sup>'+doc.variation+'</sup>');
} }
print('</h2>'); ?></h2>
<?js
if (doc.classdesc) { if (doc.classdesc) {
print('<p class="class-description">'+doc.classdesc+'</p>'); print('<p class="class-description">'+doc.classdesc+'</p>');
} }
@ -193,14 +191,17 @@
</section> </section>
<?js }); ?> <?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>

View File

@ -0,0 +1,5 @@
/**
A builder function for the Stick application;
@var {function} Application
*/
var {Application} = require("stick");