Map all symbols to modules

This commit is contained in:
ahocevar
2018-05-18 12:27:52 -05:00
committed by Tim Schaub
parent c008dd1f2c
commit 5a4a98fbe4
+7 -6
View File
@@ -14,11 +14,10 @@ info.symbols.forEach(symbol => {
if (!mod) { if (!mod) {
throw new Error(`No module for symbol ${symbol.name}`); throw new Error(`No module for symbol ${symbol.name}`);
} }
const kind = symbol.kind; if (!mod.symbols) {
if (!mod[kind]) { mod.symbols = [];
mod[kind] = [];
} }
mod[kind].push(symbol); mod.symbols.push(symbol);
}); });
function getModuleName(longname) { function getModuleName(longname) {
@@ -41,7 +40,9 @@ class Docs extends Component {
<a name={slug} href={`#${slug}`}> <a name={slug} href={`#${slug}`}>
<h1>{getModuleName(mod.name)}</h1> <h1>{getModuleName(mod.name)}</h1>
<h2>Classes</h2> <h2>Classes</h2>
{mod.class.map(cls => this.renderClass(cls, mod))} {mod.symbols
.filter(sym => sym.kind === 'class')
.map(cls => this.renderClass(cls, mod))}
</a> </a>
</section> </section>
); );
@@ -59,7 +60,7 @@ class Docs extends Component {
render() { render() {
return ( return (
<div>{modules.filter(mod => !!mod.class).map(this.renderModule)}</div> <div>{modules.filter(mod => !!mod.symbols).map(this.renderModule)}</div>
); );
} }
} }