From e5daeb9fe276887de95af4995ec53db2b4f407d4 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Wed, 24 Jun 2020 14:06:09 +0200 Subject: Divergent rendering for markdown --- .../src/main/kotlin/renderers/DefaultRenderer.kt | 7 ++ .../kotlin/signatures/KotlinSignatureProvider.kt | 2 +- .../documentables/DefaultPageCreator.kt | 4 +- .../documentables/PageContentBuilder.kt | 76 ++++++++++------------ 4 files changed, 45 insertions(+), 44 deletions(-) (limited to 'plugins/base') diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index f4d547e3..a946aa6f 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -117,11 +117,18 @@ abstract class DefaultRenderer( is ContentBreakLine -> buildNewLine() is PlatformHintedContent -> buildPlatformDependent(node, pageContext, sourceSetRestriction) is ContentDivergentGroup -> buildDivergent(node, pageContext) + is ContentDivergentInstance -> buildDivergentInstance(node, pageContext) else -> buildError(node) } } } + open fun T.buildDivergentInstance(node: ContentDivergentInstance, pageContext: ContentPage) { + node.before?.build(this, pageContext) + node.divergent.build(this, pageContext) + node.after?.build(this, pageContext) + } + open fun buildPageContent(context: T, page: ContentPage) { context.buildNavigation(page) page.content.build(context, page) diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 28c26dea..5a497878 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -289,7 +289,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog is OtherParameter -> link(p.name, p.declarationDRI) is TypeConstructor -> if (p.function) - +funType(mainDRI.single(), mainPlatformData, p) + +funType(mainDRI.single(), mainSourcesetData, p) else group(styles = emptySet()) { link(p.dri.classNames.orEmpty(), p.dri) diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index a926857f..fec986a9 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -145,7 +145,9 @@ open class DefaultPageCreator( if (map.values.any()) { header(2, "Inheritors") { } +ContentTable( - emptyList(), + listOf(contentBuilder.contentFor(mainDRI, mainSourcesetData){ + text("Name") + }), map.entries.flatMap { entry -> entry.value.map { Pair(entry.key, it) } } .groupBy({ it.second }, { it.first }).map { (classlike, platforms) -> buildGroup(setOf(dri), platforms.toSet(), ContentKind.Inheritors) { diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 76e92268..babcc1c7 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -58,7 +58,7 @@ open class PageContentBuilder( @ContentBuilderMarker open inner class DocumentableContentBuilder( val mainDRI: Set, - val mainPlatformData: Set, + val mainSourcesetData: Set, val mainStyles: Set