mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Added support for @access tag.
This commit is contained in:
parent
fc5319020f
commit
8507f83e88
@ -8,6 +8,20 @@
|
|||||||
(function() {
|
(function() {
|
||||||
exports.defineTags = function(dictionary) {
|
exports.defineTags = function(dictionary) {
|
||||||
|
|
||||||
|
dictionary.defineTag('access', {
|
||||||
|
musHaveValue: true,
|
||||||
|
onTagged: function(doclet, tag) {
|
||||||
|
if ( /^(private|protected)$/.test(tag.value) ) {
|
||||||
|
doclet.access = tag.value;
|
||||||
|
}
|
||||||
|
else if (tag.value === 'public') {
|
||||||
|
delete doclet.access;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
dictionary.defineTag('borrows', {
|
dictionary.defineTag('borrows', {
|
||||||
mustHaveValue: true,
|
mustHaveValue: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
|
|||||||
13
test/cases/accesstag.js
Normal file
13
test/cases/accesstag.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/** @constructor */
|
||||||
|
function Thingy() {
|
||||||
|
|
||||||
|
/** @access private */
|
||||||
|
var foo = 0;
|
||||||
|
|
||||||
|
/** @access protected */
|
||||||
|
this._bar = 1;
|
||||||
|
|
||||||
|
/** @access public */
|
||||||
|
this.pez = 2;
|
||||||
|
|
||||||
|
}
|
||||||
@ -89,6 +89,7 @@ testFile('test/t/cases/modules/data/mod-2.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');
|
||||||
|
|
||||||
|
testFile('test/t/cases/accesstag.js');
|
||||||
testFile('test/t/cases/globaltag.js');
|
testFile('test/t/cases/globaltag.js');
|
||||||
|
|
||||||
report();
|
report();
|
||||||
|
|||||||
21
test/t/cases/accesstag.js
Normal file
21
test/t/cases/accesstag.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
(function() {
|
||||||
|
var docSet = testhelpers.getDocSetFromFile('test/cases/accesstag.js'),
|
||||||
|
foo = docSet.getByLongname('Thingy~foo')[0],
|
||||||
|
_bar = docSet.getByLongname('Thingy#_bar')[0],
|
||||||
|
pez = docSet.getByLongname('Thingy#pez')[0];
|
||||||
|
|
||||||
|
//dump(docSet.doclets);
|
||||||
|
|
||||||
|
test('When a symbol has a @private tag, the doclet has a access="private" property.', function() {
|
||||||
|
assert.equal(foo.access, 'private');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('When a symbol has a @protected tag, the doclet has a access="protected" property.', function() {
|
||||||
|
assert.equal(_bar.access, 'protected');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('When a symbol has a @public tag, the doclet has no access property.', function() {
|
||||||
|
assert.equal(typeof pez.access, 'undefined');
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
Loading…
x
Reference in New Issue
Block a user