diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h
index a6d637d184..74f7a3c89f 100644
--- a/interface/src/avatar/MyAvatar.h
+++ b/interface/src/avatar/MyAvatar.h
@@ -60,6 +60,10 @@ class MyAvatar : public Avatar {
* change the avatar's position within the domain, or manage the avatar's collisions with other objects.
*
* @namespace MyAvatar
+ *
+ * @hifi-interface
+ * @hifi-client-entity
+ *
* @property {Vec3} qmlPosition - A synonym for position
for use by QML.
* @property {boolean} shouldRenderLocally=true - If true
then your avatar is rendered for you in Interface,
* otherwise it is not rendered for you (but it is still rendered for other users).
diff --git a/tools/jsdoc/plugins/hifi.js b/tools/jsdoc/plugins/hifi.js
index 5206edb0e2..7c643d398c 100644
--- a/tools/jsdoc/plugins/hifi.js
+++ b/tools/jsdoc/plugins/hifi.js
@@ -9,21 +9,25 @@ function endsWith(path, exts) {
}
exports.handlers = {
+
+ // This event is triggered before parsing has even started.
+ // We use this event to scan the C++ files for jsdoc comments
+ // and reformat them into a form digestable by jsdoc.
beforeParse: function(e) {
- const pathTools = require('path');
+ var pathTools = require('path');
var rootFolder = pathTools.dirname(e.filename);
console.log("Scanning hifi source for jsdoc comments...");
// directories to scan for jsdoc comments
var dirList = [
'../../interface/src',
- '../../interface/src/assets',
- '../../interface/src/audio',
+ '../../interface/src/assets',
+ '../../interface/src/audio',
'../../interface/src/avatar',
- '../../interface/src/commerce',
- '../../interface/src/devices',
- '../../interface/src/java',
- '../../interface/src/networking',
+ '../../interface/src/commerce',
+ '../../interface/src/devices',
+ '../../interface/src/java',
+ '../../interface/src/networking',
'../../interface/src/ui/',
'../../interface/src/scripting',
'../../interface/src/ui/overlays',
@@ -50,25 +54,93 @@ exports.handlers = {
'../../libraries/trackers/src/trackers',
'../../libraries/ui/src/ui',
'../../plugins/oculus/src',
- '../../plugins/openvr/src',
+ '../../plugins/openvr/src'
];
+
+ // only files with this extension will be searched for jsdoc comments.
var exts = ['.h', '.cpp'];
- const fs = require('fs');
+ var fs = require('fs');
dirList.forEach(function (dir) {
var joinedDir = pathTools.join(rootFolder, dir);
- var files = fs.readdirSync(joinedDir)
+ var files = fs.readdirSync(joinedDir);
files.forEach(function (file) {
var path = pathTools.join(joinedDir, file);
if (fs.lstatSync(path).isFile() && endsWith(path, exts)) {
+ // load entire file into a string
var data = fs.readFileSync(path, "utf8");
+
+ // this regex searches for blocks starting with /**jsdoc and end with */
var reg = /(\/\*\*jsdoc(.|[\r\n])*?\*\/)/gm;
var matches = data.match(reg);
if (matches) {
- e.source += matches.map(function (s) { return s.replace('/**jsdoc', '/**'); }).join('\n');
+ // add to source, but strip off c-comment asterisks
+ e.source += matches.map(function (s) {
+ return s.replace('/**jsdoc', '/**');
+ }).join('\n');
}
}
});
});
+ },
+
+ // This event is triggered when a new doclet has been created
+ // but before it is passed to the template for output
+ newDoclet: function (e) {
+
+ // we only care about hifi custom tags on namespace and class doclets
+ if (e.doclet.kind === "namespace" || e.doclet.kind === "class") {
+ var rows = [];
+ if (e.doclet.hifiInterface) {
+ rows.push("Interface Scripts");
+ }
+ if (e.doclet.hifiAssignmentClient) {
+ rows.push("Assignment Client Scripts");
+ }
+ if (e.doclet.hifiClientEntity) {
+ rows.push("Client Entity Scripts");
+ }
+ if (e.doclet.hifiServerEntity) {
+ rows.push("Server Entity Scripts");
+ }
+
+ // Append an Available In: table at the end of the namespace description.
+ if (rows.length > 0) {
+ var table = "
Available In: | " + rows.join(" | ") + " |