Use JSDoc's stock event documentation

This commit is contained in:
ahocevar
2014-03-25 18:21:08 +01:00
parent f37245963c
commit 7e850ca33d
8 changed files with 32 additions and 66 deletions
-1
View File
@@ -21,7 +21,6 @@
"apidoc/plugins/inheritdoc",
"apidoc/plugins/exports",
"apidoc/plugins/todo",
"apidoc/plugins/event",
"apidoc/plugins/observable",
"apidoc/plugins/stability"
],
-18
View File
@@ -1,18 +0,0 @@
var util = require('util');
exports.defineTags = function(dictionary) {
dictionary.defineTag('event', {
mustHaveValue: true,
canHaveType: false,
canHaveName: true,
onTagged: function(doclet, tag) {
var parts = tag.text.split(' ');
if (!doclet.events) {
doclet.events = [];
}
doclet.events.push({
name: tag.value.name,
description: parts.slice(1).join(' ')
});
}
});
};
+6
View File
@@ -21,6 +21,12 @@ exports.defineTags = function(dictionary) {
description: description,
readonly: readonly
});
if (!doclet.fires) {
doclet.fires = [];
}
if (doclet.fires.indexOf('{@link ol.ObjectEvent} ol.event:ObjectEvent') === -1) {
doclet.fires.push('{@link ol.ObjectEvent} ol.event:ObjectEvent');
}
}
});
};
+5 -7
View File
@@ -22,14 +22,12 @@ exports.defineTags = function(dictionary) {
description: description,
readonly: readonly
});
} else if (parts[0] === 'event') {
if (!doclet.events) {
doclet.events = [];
if (!doclet.fires) {
doclet.fires = [];
}
if (doclet.fires.indexOf('{@link ol.ObjectEvent} ol.event:ObjectEvent') === -1) {
doclet.fires.push('{@link ol.ObjectEvent} ol.event:ObjectEvent');
}
doclet.events.push({
name: parts[1],
description: parts.slice(2).join(' ')
});
}
}
});
-21
View File
@@ -1,21 +0,0 @@
<table class="props">
<thead>
<tr>
<th>Name</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<?js
obj.forEach(function(prop) {
if (!prop) { return; }
var setter = prop.readonly ? 'no' : 'yes';
?>
<tr>
<td class="name"><code><?js= prop.name ?></code></td>
<td class="description last"><?js= prop.description ?></td>
</tr>
<?js }); ?>
</tbody>
</table>