diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-07-15 15:46:08 +0200 |
---|---|---|
committer | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-07-15 18:08:15 +0200 |
commit | e1f3417a22942d168ace994734add42cc01d3694 (patch) | |
tree | 4e29c8406982d4a27699c9f521b78a114dd9fcb0 /plugins/base | |
parent | e32e42e084d4e150387a7e9ec4ee00ae3974babd (diff) | |
download | dokka-e1f3417a22942d168ace994734add42cc01d3694.tar.gz dokka-e1f3417a22942d168ace994734add42cc01d3694.tar.bz2 dokka-e1f3417a22942d168ace994734add42cc01d3694.zip |
Show sourcesets from extension points as a part of page's sourceset
Diffstat (limited to 'plugins/base')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index f8dbde60..5180d4fc 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -182,7 +182,13 @@ open class DefaultPageCreator( } protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) { - group(kind = ContentKind.Cover) { + @Suppress("UNCHECKED_CAST") + val extensions = (c as WithExtraProperties<DClasslike>) + .extra[CallableExtensions]?.extensions + ?.filterIsInstance<Documentable>().orEmpty() + // Extensions are added to sourceSets since they can be placed outside the sourceSets from classlike + // Example would be an Interface in common and extension function in jvm + group(kind = ContentKind.Cover, sourceSets = mainSourcesetData + extensions.sourceSets) { cover(c.name.orEmpty()) sourceSetDependentHint(c.dri, c.sourceSets) { +contentForDescription(c) @@ -190,7 +196,7 @@ open class DefaultPageCreator( } } - group(styles = setOf(ContentStyle.TabbedContent)) { + group(styles = setOf(ContentStyle.TabbedContent), sourceSets = mainSourcesetData + extensions.sourceSets) { +contentForComments(c) if (c is WithConstructors) { block( @@ -233,12 +239,7 @@ open class DefaultPageCreator( } +contentForScope(c, c.dri, c.sourceSets) - @Suppress("UNCHECKED_CAST") - val extensions = (c as WithExtraProperties<DClasslike>) - .extra[CallableExtensions]?.extensions - ?.filterIsInstance<Documentable>() - - divergentBlock("Extensions", extensions.orEmpty(), ContentKind.Extensions, extra = mainExtra + SimpleAttr.header("Extensions")) + divergentBlock("Extensions", extensions, ContentKind.Extensions, extra = mainExtra + SimpleAttr.header("Extensions")) } } @@ -518,4 +519,7 @@ open class DefaultPageCreator( protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() + + private val List<Documentable>.sourceSets: Set<DokkaSourceSet> + get() = flatMap { it.sourceSets }.toSet() } |