mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge branch 'master' of github.com:micmath/jsdoc
This commit is contained in:
commit
ce7338d8c9
16
jsdoc.js
16
jsdoc.js
@ -155,8 +155,18 @@ function main() {
|
|||||||
throw('Configuration file cannot be evaluated. '+e);
|
throw('Configuration file cannot be evaluated. '+e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow to pass arguments from configuration file
|
||||||
|
if (env.conf.opts) {
|
||||||
|
for (var opt in env.conf.opts) {
|
||||||
|
// arguments passed in command are more important
|
||||||
|
if (!(opt in env.opts)) {
|
||||||
|
env.opts[opt] = env.conf.opts[opt];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (env.opts.query) {
|
if (env.opts.query) {
|
||||||
env.opts.query = require('query').toObject(env.opts.query);
|
env.opts.query = require('common/query').toObject(env.opts.query);
|
||||||
}
|
}
|
||||||
|
|
||||||
// which version of javascript will be supported? (rhino only)
|
// which version of javascript will be supported? (rhino only)
|
||||||
@ -230,10 +240,10 @@ function main() {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
env.opts.template = env.opts.template || 'default';
|
env.opts.template = env.opts.template || 'templates/default';
|
||||||
|
|
||||||
// should define a global "publish" function
|
// should define a global "publish" function
|
||||||
include('templates/' + env.opts.template + '/publish.js');
|
include(env.opts.template + '/publish.js');
|
||||||
|
|
||||||
if (typeof publish === 'function') {
|
if (typeof publish === 'function') {
|
||||||
publish(
|
publish(
|
||||||
|
|||||||
@ -12,7 +12,7 @@ var common = {
|
|||||||
var argParser = new common.args.ArgParser(),
|
var argParser = new common.args.ArgParser(),
|
||||||
ourOptions,
|
ourOptions,
|
||||||
defaults = {
|
defaults = {
|
||||||
template: 'default',
|
template: 'templates/default',
|
||||||
destination: './out/'
|
destination: './out/'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -113,6 +113,11 @@ exports.jsdocSchema = {
|
|||||||
"maxItems": 1,
|
"maxItems": 1,
|
||||||
"enum": ["private", "protected", "public"]
|
"enum": ["private", "protected", "public"]
|
||||||
},
|
},
|
||||||
|
"virtual": { // is a member left to be implemented during inheritance?
|
||||||
|
"type": "boolean",
|
||||||
|
"optional": true,
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"attrib": { // other attributes, like "readonly"
|
"attrib": { // other attributes, like "readonly"
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"optional": true
|
"optional": true
|
||||||
|
|||||||
@ -11,6 +11,15 @@
|
|||||||
*/
|
*/
|
||||||
exports.defineTags = function(dictionary) {
|
exports.defineTags = function(dictionary) {
|
||||||
|
|
||||||
|
dictionary.defineTag('abstract', {
|
||||||
|
mustNotHaveValue: true,
|
||||||
|
onTagged: function(doclet, tag) {
|
||||||
|
// since "abstract" is reserved word in JavaScript let's use "virtual" in code
|
||||||
|
doclet.virtual = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.synonym('virtual');
|
||||||
|
|
||||||
dictionary.defineTag('access', {
|
dictionary.defineTag('access', {
|
||||||
mustHaveValue: true,
|
mustHaveValue: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
|
|||||||
@ -108,6 +108,10 @@
|
|||||||
function addAttribs(f) {
|
function addAttribs(f) {
|
||||||
var attribs = [];
|
var attribs = [];
|
||||||
|
|
||||||
|
if (f.virtual) {
|
||||||
|
attribs.push('virtual');
|
||||||
|
}
|
||||||
|
|
||||||
if (f.access && f.access !== 'public') {
|
if (f.access && f.access !== 'public') {
|
||||||
attribs.push(f.access);
|
attribs.push(f.access);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,8 @@
|
|||||||
var thisNamespace = parentNode.namespaces[element.name] = {
|
var thisNamespace = parentNode.namespaces[element.name] = {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
'description': element.description || '',
|
'description': element.description || '',
|
||||||
'access': element.access || ''
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual
|
||||||
};
|
};
|
||||||
|
|
||||||
graft(thisNamespace, childNodes, element.longname, element.name);
|
graft(thisNamespace, childNodes, element.longname, element.name);
|
||||||
@ -64,7 +65,8 @@
|
|||||||
var thisMixin = parentNode.mixins[element.name] = {
|
var thisMixin = parentNode.mixins[element.name] = {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
'description': element.description || '',
|
'description': element.description || '',
|
||||||
'access': element.access || ''
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual
|
||||||
};
|
};
|
||||||
|
|
||||||
graft(thisMixin, childNodes, element.longname, element.name);
|
graft(thisMixin, childNodes, element.longname, element.name);
|
||||||
@ -77,6 +79,7 @@
|
|||||||
var thisFunction = parentNode.functions[element.name] = {
|
var thisFunction = parentNode.functions[element.name] = {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
'access': element.access || '',
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual,
|
||||||
'description': element.description || '',
|
'description': element.description || '',
|
||||||
'parameters': [ ]
|
'parameters': [ ]
|
||||||
};
|
};
|
||||||
@ -108,6 +111,7 @@
|
|||||||
parentNode.properties[element.name] = {
|
parentNode.properties[element.name] = {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
'access': element.access || '',
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual,
|
||||||
'description': element.description || '',
|
'description': element.description || '',
|
||||||
'type': element.type? (element.type.length === 1? element.type[0] : element.type) : ''
|
'type': element.type? (element.type.length === 1? element.type[0] : element.type) : ''
|
||||||
};
|
};
|
||||||
@ -121,6 +125,7 @@
|
|||||||
var thisEvent = parentNode.events[element.name] = {
|
var thisEvent = parentNode.events[element.name] = {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
'access': element.access || '',
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual,
|
||||||
'description': element.description || '',
|
'description': element.description || '',
|
||||||
'parameters': [
|
'parameters': [
|
||||||
]
|
]
|
||||||
@ -156,6 +161,7 @@
|
|||||||
'description': element.classdesc || '',
|
'description': element.classdesc || '',
|
||||||
'extends': element.augments || [],
|
'extends': element.augments || [],
|
||||||
'access': element.access || '',
|
'access': element.access || '',
|
||||||
|
'virtual': !!element.virtual,
|
||||||
'fires': element.fires || '',
|
'fires': element.fires || '',
|
||||||
'constructor': {
|
'constructor': {
|
||||||
'name': element.name,
|
'name': element.name,
|
||||||
|
|||||||
17
test/cases/abstracttag.js
Normal file
17
test/cases/abstracttag.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/** @constructor */
|
||||||
|
function Thingy() {
|
||||||
|
|
||||||
|
/** @abstract */
|
||||||
|
this.pez = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// same as...
|
||||||
|
|
||||||
|
/** @constructor */
|
||||||
|
function OtherThingy() {
|
||||||
|
|
||||||
|
/** @virtual */
|
||||||
|
this.pez = 2;
|
||||||
|
|
||||||
|
}
|
||||||
@ -103,6 +103,7 @@ testFile('test/t/cases/innerscope2.js');
|
|||||||
testFile('test/t/cases/modules/data/mod-1.js');
|
testFile('test/t/cases/modules/data/mod-1.js');
|
||||||
testFile('test/t/cases/modules/data/mod-2.js');
|
testFile('test/t/cases/modules/data/mod-2.js');
|
||||||
|
|
||||||
|
testFile('test/t/cases/abstracttag.js');
|
||||||
testFile('test/t/cases/accesstag.js');
|
testFile('test/t/cases/accesstag.js');
|
||||||
testFile('test/t/cases/alias.js');
|
testFile('test/t/cases/alias.js');
|
||||||
testFile('test/t/cases/alias2.js');
|
testFile('test/t/cases/alias2.js');
|
||||||
|
|||||||
22
test/t/cases/abstracttag.js
Normal file
22
test/t/cases/abstracttag.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
(function() {
|
||||||
|
var docSet = testhelpers.getDocSetFromFile('test/cases/abstracttag.js'),
|
||||||
|
type = docSet.getByLongname('Thingy')[0]
|
||||||
|
pez = docSet.getByLongname('Thingy#pez')[0];
|
||||||
|
|
||||||
|
test('By default symbol has virtual=undefined property.', function() {
|
||||||
|
assert.equal(!!type.virtual, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('When a symbol has a @abstract tag, the doclet has a virtual=true property.', function() {
|
||||||
|
assert.equal(pez.virtual, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
// same as...
|
||||||
|
|
||||||
|
pez = docSet.getByLongname('OtherThingy#pez')[0];
|
||||||
|
|
||||||
|
test('When a symbol has a @virtual tag, the doclet has a virtual=true property.', function() {
|
||||||
|
assert.equal(pez.virtual, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
Loading…
x
Reference in New Issue
Block a user