Add list of static functions

This commit is contained in:
ahocevar
2018-05-18 17:19:58 -04:00
committed by Tim Schaub
parent 2fa6af0636
commit 9a08666f1f

View File

@@ -28,6 +28,14 @@ function getClassName(longname) {
return longname.split('~').pop();
}
function getFunctionName(longname) {
return longname.split('.').pop();
}
function isMember(symbol) {
return symbol.name.indexOf('#') !== -1;
}
function slugify(name) {
return name.replace(/[#~\.]/g, '-');
}
@@ -43,6 +51,10 @@ class Docs extends Component {
{mod.symbols
.filter(sym => sym.kind === 'class')
.map(cls => this.renderClass(cls, mod))}
<h2>Functions</h2>
{mod.symbols
.filter(sym => sym.kind === 'function' && !isMember(sym))
.map(fn => this.renderFunction(fn, mod))}
</a>
</section>
);
@@ -58,6 +70,18 @@ class Docs extends Component {
);
}
renderFunction(fn, mod) {
return (
<p key={fn.name}>
<code>
import &#123;{getFunctionName(fn.name)}&#125; from &apos;{getModuleName(
mod.name
)}&apos;;
</code>
</p>
);
}
render() {
return (
<div>{modules.filter(mod => !!mod.symbols).map(this.renderModule)}</div>