From 0482b7ced4644e82a12c9a9cffd4bd2e2423f5dd Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 19 May 2018 11:16:03 +0200 Subject: [PATCH] List classes without API constructor TODO: No import should be listed for these. --- config/jsdoc/info/publish.js | 3 +++ site/src/pages/docs.js | 37 ++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/config/jsdoc/info/publish.js b/config/jsdoc/info/publish.js index f902db9e06..1225e63617 100644 --- a/config/jsdoc/info/publish.js +++ b/config/jsdoc/info/publish.js @@ -79,6 +79,9 @@ exports.publish = function(data, opts) { if (doc.augments) { symbol.extends = doc.augments[0]; } + if (doc.memberof) { + symbol.memberof = doc.memberof; + } if (doc.virtual) { symbol.virtual = true; } diff --git a/site/src/pages/docs.js b/site/src/pages/docs.js index 9b31a5a41f..71adee99e3 100644 --- a/site/src/pages/docs.js +++ b/site/src/pages/docs.js @@ -14,6 +14,16 @@ info.symbols.forEach(symbol => { if (!mod) { throw new Error(`No module for symbol ${symbol.name}`); } + if (symbol.memberof || symbol.kind === 'class') { + const name = symbol.memberof || symbol.name; + if (!mod.classes) { + mod.classes = {}; + } + if (!mod.classes[name]) { + mod.classes[name] = {}; + } + mod.classes[name][symbol.name] = symbol; + } if (!mod.symbols) { mod.symbols = []; } @@ -44,17 +54,18 @@ class Docs extends Component {

{getModuleName(mod.name)}

Classes

- {mod.symbols - .filter(sym => sym.kind === 'class') - .map(cls => this.renderClass(cls, mod))} + {mod.classes && + Object.keys(mod.classes).map(cls => this.renderClass(cls, mod))}

Functions

- {mod.symbols - .filter(sym => sym.kind === 'function' && !isMember(sym)) - .map(fn => this.renderFunction(fn, mod))} + {mod.symbols && + mod.symbols + .filter(sym => sym.kind === 'function' && !isMember(sym)) + .map(fn => this.renderFunction(fn, mod))}

Constants

- {mod.symbols - .filter(sym => sym.kind === 'constant' && !isMember(sym)) - .map(constant => this.renderConstant(constant, mod))} + {mod.symbols && + mod.symbols + .filter(sym => sym.kind === 'constant' && !isMember(sym)) + .map(constant => this.renderConstant(constant, mod))}
); @@ -62,9 +73,9 @@ class Docs extends Component { renderClass(cls, mod) { return ( -

+

- import {getName(cls.name)} from '{getModuleName(mod.name)}'; + import {getName(cls)} from '{getModuleName(mod.name)}';

); @@ -95,9 +106,7 @@ class Docs extends Component { } render() { - return ( -
{modules.filter(mod => !!mod.symbols).map(this.renderModule)}
- ); + return
{modules.map(this.renderModule)}
; } }