diff options
Diffstat (limited to 'plugins/base')
3 files changed, 17 insertions, 25 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 6d73bfdc..9d153a19 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -137,20 +137,23 @@ open class PageContentBuilder( platformData: Set<PlatformData> = mainPlatformData, styles: Set<Style> = mainStyles, extras: Set<Extra> = mainExtras, + renderWhenEmpty: Boolean = false, operation: DocumentableContentBuilder.(T) -> Unit ) { - header(level) { text(name) } - contents += ContentTable( - emptyList(), - elements.map { - group(it.dri, it.platformData.toSet(), kind, styles, extras) { - // TODO this will fail - operation(it) - } - }, - DCI(setOf(mainDRI), kind), - platformData, styles, extras - ) + if (renderWhenEmpty || elements.any()) { + header(level) { text(name) } + contents += ContentTable( + emptyList(), + elements.map { + group(it.dri, it.platformData.toSet(), kind, styles, extras) { + // TODO this will fail + operation(it) + } + }, + DCI(setOf(mainDRI), kind), + platformData, styles, extras + ) + } } fun <T> list( diff --git a/plugins/base/src/test/resources/expect/test/out/root/fn.html b/plugins/base/src/test/resources/expect/test/out/root/fn.html index f272cbe7..806730da 100644 --- a/plugins/base/src/test/resources/expect/test/out/root/fn.html +++ b/plugins/base/src/test/resources/expect/test/out/root/fn.html @@ -15,15 +15,9 @@ <div id="content">//<a href="../index.html">root</a>/<a href="index.html"></a>/<a href="fn.html">fn</a> <h1>fn</h1> fun <a href="fn.html">fn</a>() - <h3>Description [jvm]</h3> + <h3>Description</h3> Function fn - - <h2>Parameters</h2> - <table> - <thead></thead> - <tbody></tbody> - </table> - </div> +</div> </body> </html> diff --git a/plugins/base/src/test/resources/expect/test/out/root/index.html b/plugins/base/src/test/resources/expect/test/out/root/index.html index c17e426d..fa51a24a 100644 --- a/plugins/base/src/test/resources/expect/test/out/root/index.html +++ b/plugins/base/src/test/resources/expect/test/out/root/index.html @@ -14,11 +14,6 @@ </div> <div id="content">//<a href="../index.html">root</a>/<a href="index.html"></a> <h1>Package </h1> - <h2>Types</h2> - <table> - <thead></thead> - <tbody></tbody> - </table> <h2>Functions</h2> <table> <thead></thead> |