diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-07-01 17:36:50 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-07-07 10:07:21 +0200 |
commit | 0533ef9a56ae34138a3f8a5e996805713c48c384 (patch) | |
tree | 9130b79b048feb003b704d0f5024809037944bf2 /plugins/gfm/src | |
parent | 177ede83228515f03436a4ac0ce1ce573fc3d74b (diff) | |
download | dokka-0533ef9a56ae34138a3f8a5e996805713c48c384.tar.gz dokka-0533ef9a56ae34138a3f8a5e996805713c48c384.tar.bz2 dokka-0533ef9a56ae34138a3f8a5e996805713c48c384.zip |
Add overrides to provided plugins
Diffstat (limited to 'plugins/gfm/src')
-rw-r--r-- | plugins/gfm/src/main/kotlin/GfmPlugin.kt | 35 |
1 files changed, 22 insertions, 13 deletions
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<PageTransformer>() + private val dokkaBase by lazy { plugin<DokkaBase>() } + 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<DokkaBase>().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<DokkaSourceSet>, 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<DokkaSourceSet>? ) { - 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 { |