Added support for the @see tag.

This commit is contained in:
Michael Mathews 2011-01-16 11:39:02 +00:00
parent dd990a434c
commit 176205c398
4 changed files with 37 additions and 0 deletions

View File

@ -327,6 +327,16 @@
})
.synonym('return');
dictionary.defineTag('see', {
mustHaveValue: true,
onTagged: function(doclet, tag) {
if (!doclet.see) { doclet.see = []; }
doclet.see.push(tag.value);
return true;
}
});
dictionary.defineTag('since', {
mustHaveValue: true,
onTagged: function(doclet, tag) {

11
test/cases/seetag.js Normal file
View File

@ -0,0 +1,11 @@
/**
* @see #search
*/
function foo() {
}
/**
* @see http://example.com/someref
*/
function bar() {
}

View File

@ -98,6 +98,7 @@ testFile('test/t/cases/globaltag.js');
testFile('test/t/cases/ignoretag.js');
testFile('test/t/cases/paramtag.js');
testFile('test/t/cases/returnstag.js');
testFile('test/t/cases/seetag.js');
testFile('test/t/cases/sincetag.js');
testFile('test/t/cases/typetag.js');
testFile('test/t/cases/versiontag.js');

15
test/t/cases/seetag.js Normal file
View File

@ -0,0 +1,15 @@
(function() {
var docSet = testhelpers.getDocSetFromFile('test/cases/seetag.js'),
foo = docSet.getByLongname('foo')[0],
bar = docSet.getByLongname('bar')[0];
//dump(docSet.doclets); exit(0);
test('When a symbol has an @see tag, the doclet has a see property that includes that value.', function() {
assert.equal(typeof foo.see, 'object');
assert.equal(foo.see[0], '#search');
assert.equal(typeof bar.see, 'object');
assert.equal(bar.see[0], 'http://example.com/someref');
});
})();