aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2020-06-23 12:40:39 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-06-25 20:31:42 +0200
commit72069ee58cf17e41183e9fbc8f278acc4e9a1699 (patch)
tree6f3a1b736d6740e4fbcce94c8af450faf3e6799b
parent27ff92ac42a58844dd57340f7cada14cea8b5d7f (diff)
downloaddokka-72069ee58cf17e41183e9fbc8f278acc4e9a1699.tar.gz
dokka-72069ee58cf17e41183e9fbc8f278acc4e9a1699.tar.bz2
dokka-72069ee58cf17e41183e9fbc8f278acc4e9a1699.zip
Render extensions
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt53
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt2
2 files changed, 30 insertions, 25 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 21a91f2c..ab3fb70c 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -14,6 +14,7 @@ import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
+import javax.print.Doc
import kotlin.reflect.KClass
import kotlin.reflect.full.isSubclassOf
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
@@ -23,7 +24,6 @@ private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<DokkaSourc
private val specialTags: Set<KClass<out TagWrapper>> =
setOf(Property::class, Description::class, Constructor::class, Receiver::class, Param::class, See::class)
-
open class DefaultPageCreator(
commentsToContentConverter: CommentsToContentConverter,
signatureProvider: SignatureProvider,
@@ -182,9 +182,10 @@ open class DefaultPageCreator(
}
protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) {
+ val sourceSets = c.sourceSets.toSet()
group(kind = ContentKind.Cover) {
cover(c.name.orEmpty())
- sourceSetDependentHint(c.dri, c.sourceSets.toSet()) {
+ sourceSetDependentHint(c.dri, sourceSets) {
+contentForDescription(c)
+buildSignature(c)
}
@@ -198,7 +199,7 @@ open class DefaultPageCreator(
2,
ContentKind.Constructors,
c.constructors.filter { it.extra[PrimaryConstructorExtra] == null },
- c.sourceSets.toSet(),
+ sourceSets,
extra = PropertyContainer.empty<ContentNode>() + SimpleAttr.header("Constructors")
) {
link(it.name, it.dri, kind = ContentKind.Main)
@@ -234,8 +235,11 @@ 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, mainExtra + SimpleAttr.header("Extensions"))
+ val extensions = (c as WithExtraProperties<DClasslike>)
+ .extra[CallableExtensions]?.extensions
+ ?.filterIsInstance<Documentable>()
+
+ divergentBlock("Extensions", extensions.orEmpty(), ContentKind.Extensions, extra = mainExtra + SimpleAttr.header("Extensions"))
}
}
@@ -474,40 +478,41 @@ open class DefaultPageCreator(
) {
if (collection.any()) {
header(2, name)
- table(kind, extra = extra) {
+ table(kind, extra = extra, styles = emptySet()) {
collection
.groupBy { it.name }
// This hacks displaying actual typealias signatures along classlike ones
.mapValues { if (it.value.any { it is DClasslike }) it.value.filter { it !is DTypeAlias } else it.value }
.toSortedMap(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)){it})
.map { (elementName, elements) -> // This groupBy should probably use LocationProvider
- buildGroup(
+ buildGroup(
+ dri = elements.map { it.dri }.toSet(),
+ sourceSets = elements.flatMap { it.sourceSets }.toSet(),
+ kind = kind,
+ styles = emptySet()
+ ) {
+ link(elementName.orEmpty(), elements.first().dri, kind = kind)
+ divergentGroup(
+ ContentDivergentGroup.GroupID(name),
elements.map { it.dri }.toSet(),
- elements.flatMap { it.sourceSets }.toSet(),
kind = kind
) {
- link(elementName.orEmpty(), elements.first().dri, kind = kind)
- divergentGroup(
- ContentDivergentGroup.GroupID(name),
- elements.map { it.dri }.toSet(),
- kind = kind
- ) {
- elements.map {
- instance(setOf(it.dri), it.sourceSets.toSet()) {
- before {
- contentForBrief(it)
- contentForSinceKotlin(it)
- }
- divergent {
- group {
- +buildSignature(it)
- }
+ elements.map {
+ instance(setOf(it.dri), it.sourceSets.toSet()) {
+ before {
+ contentForBrief(it)
+ contentForSinceKotlin(it)
+ }
+ divergent {
+ group {
+ +buildSignature(it)
}
}
}
}
}
}
+ }
}
}
}
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index a58ef114..76e92268 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -467,7 +467,7 @@ open class PageContentBuilder(
) =
ContentDivergentInstance(
before,
- divergent!!,
+ divergent ?: throw IllegalStateException("Divergent block needs divergent part"),
after,
DCI(mainDRI, kind),
sourceSets,