From 0533ef9a56ae34138a3f8a5e996805713c48c384 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 1 Jul 2020 17:36:50 +0200 Subject: Add overrides to provided plugins --- plugins/gfm/src/main/kotlin/GfmPlugin.kt | 35 ++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'plugins/gfm/src/main/kotlin/GfmPlugin.kt') diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt index 287ef74f..32c0b7b7 100644 --- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt +++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt @@ -19,12 +19,20 @@ class GfmPlugin : DokkaPlugin() { val gfmPreprocessors by extensionPoint() + private val dokkaBase by lazy { plugin() } + val renderer by extending { - CoreExtensions.renderer providing { CommonmarkRenderer(it) } applyIf { format == "gfm" } + (CoreExtensions.renderer + providing { CommonmarkRenderer(it) } + applyIf { format == "gfm" } + override dokkaBase.htmlRenderer) } val locationProvider by extending { - plugin().locationProviderFactory providing { MarkdownLocationProviderFactory(it) } applyIf { format == "gfm" } + (dokkaBase.locationProviderFactory + providing { MarkdownLocationProviderFactory(it) } + applyIf { format == "gfm" } + override dokkaBase.locationProvider) } val rootCreator by extending { @@ -32,13 +40,9 @@ class GfmPlugin : DokkaPlugin() { } val packageListCreator by extending { - gfmPreprocessors providing { - PackageListCreator( - it, - "gfm", - "md" - ) - } order { after(rootCreator) } + (gfmPreprocessors + providing { PackageListCreator(it, "gfm", "md") } + order { after(rootCreator) }) } } @@ -128,7 +132,7 @@ open class CommonmarkRenderer( sourceSets: Set, pageContext: ContentPage, ) { - if(content is ContentGroup && content.children.firstOrNull{ it is ContentTable } != null){ + if (content is ContentGroup && content.children.firstOrNull { it is ContentTable } != null) { buildContentNode(content, pageContext) } else { val distinct = sourceSets.map { @@ -155,11 +159,16 @@ open class CommonmarkRenderer( pageContext: ContentPage, sourceSetRestriction: Set? ) { - if(node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters){ - node.sourceSets.forEach {sourcesetData -> + if (node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters) { + node.sourceSets.forEach { sourcesetData -> append("${sourcesetData.moduleDisplayName}/${sourcesetData.sourceSetID}") buildNewLine() - buildTable(node.copy(children = node.children.filter { it.sourceSets.contains(sourcesetData) }, dci = node.dci.copy(kind = ContentKind.Main)), pageContext, sourceSetRestriction) + buildTable( + node.copy( + children = node.children.filter { it.sourceSets.contains(sourcesetData) }, + dci = node.dci.copy(kind = ContentKind.Main) + ), pageContext, sourceSetRestriction + ) buildNewLine() } } else { -- cgit