diff --git a/apidoc/conf.json b/apidoc/conf.json index 72bc7c9173..5c56857620 100644 --- a/apidoc/conf.json +++ b/apidoc/conf.json @@ -13,11 +13,17 @@ "plugins": [ "plugins/markdown", "apidoc/plugins/inheritdoc", - "apidoc/plugins/exports" + "apidoc/plugins/exports", + "apidoc/plugins/todo", + "apidoc/plugins/observable", + "apidoc/plugins/stability" ], "markdown": { "parser": "gfm" }, + "stability": { + "levels": ["deprecated","experimental","unstable","stable","frozen","locked"] + }, "templates": { "cleverLinks": false, "monospaceLinks": false, diff --git a/apidoc/plugins/observable.js b/apidoc/plugins/observable.js new file mode 100644 index 0000000000..14bf45a722 --- /dev/null +++ b/apidoc/plugins/observable.js @@ -0,0 +1,26 @@ +var util = require('util'); +exports.defineTags = function(dictionary) { + dictionary.defineTag('observable', { + mustHaveValue: true, + canHaveType: true, + canHaveName: true, + onTagged: function(doclet, tag) { + if (!doclet.observables) { + doclet.observables = []; + } + var description = tag.value.description; + var readonly = description.split(' ').shift() === 'readonly'; + if (readonly) { + description = description.split(' ').slice(1).join(' '); + } + doclet.observables.push({ + name: tag.value.name, + type: { + names: tag.value.type.names + }, + description: description, + readonly: readonly + }); + } + }); +}; diff --git a/apidoc/plugins/stability.js b/apidoc/plugins/stability.js new file mode 100644 index 0000000000..bd006cdbab --- /dev/null +++ b/apidoc/plugins/stability.js @@ -0,0 +1,20 @@ +var conf = env.conf.stability; +var defaultLevels = ["deprecated","experimental","unstable","stable","frozen","locked"]; +var levels = conf.levels || defaultLevels; +var util = require('util'); +exports.defineTags = function(dictionary) { + dictionary.defineTag('stability', { + mustHaveValue: true, + canHaveType: false, + canHaveName: true, + onTagged: function(doclet, tag) { + var level = tag.text; + if (levels.indexOf(level) >=0) { + doclet.stability = level; + } else { + var errorText = util.format('Invalid stability level (%s) in %s line %s', tag.text, doclet.meta.filename, doclet.meta.lineno); + require('jsdoc/util/error').handle( new Error(errorText) ); + } + } + }) +}; diff --git a/apidoc/plugins/todo.js b/apidoc/plugins/todo.js new file mode 100644 index 0000000000..1389daaa32 --- /dev/null +++ b/apidoc/plugins/todo.js @@ -0,0 +1,28 @@ +var util = require('util'); +exports.defineTags = function(dictionary) { + dictionary.defineTag('todo', { + mustHaveValue: true, + canHaveType: true, + canHaveName: true, + onTagged: function(doclet, tag) { + var parts = tag.text.split(' '); + if (parts[0] === 'stability') { + doclet.stability = parts.slice(1).join(' '); + } else if (parts[0] === 'observable') { + if (!doclet.observables) { + doclet.observables = []; + } + var readonly = parts.length > 3 && parts[3] === 'readonly'; + var description = (readonly ? parts.slice(4) : parts.slice(3)).join(' '); + doclet.observables.push({ + name: parts[2], + type: { + names: tag.value.type.names + }, + description: description, + readonly: readonly + }); + } + } + }); +}; diff --git a/apidoc/template/tmpl/container.tmpl b/apidoc/template/tmpl/container.tmpl index c546088e67..b10f51a72a 100644 --- a/apidoc/template/tmpl/container.tmpl +++ b/apidoc/template/tmpl/container.tmpl @@ -92,6 +92,15 @@ + +
| Name | +Type | +Get | +Set | +Event | +Description | +
|---|---|---|---|---|---|
|
+ + + + + | ++ | + | change: |
+ + |