Skip to content

Commit

Permalink
Fix jsdoc of style.get and similar get functions.
Browse files Browse the repository at this point in the history
jsdoc attempts to put `style.get` into the `geo.feature.style`
namespace, but `geo.feature.style` is a function, not a namespace, so it
doesn't appear.  This adds a jsdoc plugin that allows putting a dot in
the name of a doclet that appears in the rendered documentation.  This
results ins `style.get` appearing in the list of `geo.feature`'s
methods.
  • Loading branch information
manthey committed Aug 29, 2018
1 parent a0f418b commit 70e71da
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"plugins": [
"jsdoc/plugins/events",
"jsdoc/plugins/typedef_augments",
"jsdoc/plugins/dot_in_name",
"node_modules/jsdoc-autoprivate/autoprivate.js",
"plugins/markdown"
],
Expand Down
15 changes: 15 additions & 0 deletions jsdoc/plugins/dot_in_name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Allow doclet names to include a dot. The text '_DOT_' is replaced by a dot
* in the documentation.
*/
var dotToken = '_DOT_';

exports.handlers = {
processingComplete: function (e) {
e.doclets.forEach(function (doclet) {
if (doclet.name.indexOf(dotToken) >= 0) {
doclet.name = doclet.name.replace(new RegExp(dotToken, 'g'), '.');
}
});
}
};
3 changes: 3 additions & 0 deletions src/choroplethFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ var choroplethFeature = function (arg) {
* A uniform getter that always returns a function even for constant values.
* If undefined input, return all the choropleth values as an object.
*
* @function choropleth_DOT_get
* @memberof geo.choroplethFeature
* @instance
* @param {string|undefined} key defines one of the attributes of a
* choropleth.
* @return {function}
Expand Down
3 changes: 3 additions & 0 deletions src/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ var feature = function (arg) {
* A uniform getter that always returns a function even for constant styles.
* This can also return all defined styles as functions in a single object.
*
* @function style_DOT_get
* @memberof geo.feature
* @instance
* @param {string} [key] If defined, return a function for the named style.
* Otherwise, return an object with a function for all defined styles.
* @returns {function|object} Either a function for the named style or an
Expand Down
3 changes: 3 additions & 0 deletions src/meshFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ var meshFeature = function (arg) {
* A uniform getter that always returns a function even for constant values.
* If undefined input, return all the mesh values as an object.
*
* @function mesh_DOT_get
* @memberof geo.meshFeature
* @instance
* @param {string|undefined} key The name of the mesh key or `undefined` to
* return an object with all keys as functions.
* @returns {object|function} A function related to the key, or an object
Expand Down

0 comments on commit 70e71da

Please sign in to comment.