aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt7
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt76
4 files changed, 45 insertions, 44 deletions
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<T>(
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<DRI>,
- val mainPlatformData: Set<DokkaSourceSet>,
+ val mainSourcesetData: Set<DokkaSourceSet>,
val mainStyles: Set<Style>,
val mainExtra: PropertyContainer<ContentNode>
) {
@@ -85,11 +85,21 @@ open class PageContentBuilder(
contents += this
}
+ private val defaultHeaders
+ get() = listOf(
+ contentFor(mainDRI, mainSourcesetData){
+ text("Name")
+ },
+ contentFor(mainDRI, mainSourcesetData){
+ text("Summary")
+ }
+ )
+
fun header(
level: Int,
text: String,
kind: Kind = ContentKind.Main,
- platformData: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit = {}
@@ -98,7 +108,7 @@ open class PageContentBuilder(
level,
contentFor(
mainDRI,
- platformData,
+ sourceSets,
kind,
styles,
extra + SimpleAttr("anchor", text.replace("\\s".toRegex(), "").toLowerCase())
@@ -111,18 +121,18 @@ open class PageContentBuilder(
fun cover(
text: String,
- platformData: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles + TextStyle.Cover,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit = {}
) {
- header(1, text, platformData = platformData, styles = styles, extra = extra, block = block)
+ header(1, text, sourceSets = sourceSets, styles = styles, extra = extra, block = block)
}
fun text(
text: String,
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -131,34 +141,15 @@ open class PageContentBuilder(
fun buildSignature(d: Documentable) = signatureProvider.signature(d)
- fun linkTable(
- elements: List<DRI>,
- kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
- styles: Set<Style> = mainStyles,
- extra: PropertyContainer<ContentNode> = mainExtra
- ) {
- contents += ContentTable(
- emptyList(),
- elements.map {
- contentFor(it, sourceSets, kind, styles, extra) {
- link(it.classNames ?: "", it)
- }
- },
- DCI(mainDRI, kind),
- sourceSets, styles, extra
- )
- }
-
fun table(
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
operation: DocumentableContentBuilder.() -> List<ContentGroup>
) {
contents += ContentTable(
- emptyList(),
+ defaultHeaders,
operation(),
DCI(mainDRI, kind),
sourceSets, styles, extra
@@ -170,17 +161,18 @@ open class PageContentBuilder(
level: Int,
kind: Kind = ContentKind.Main,
elements: Iterable<T>,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
renderWhenEmpty: Boolean = false,
needsSorting: Boolean = true,
+ headers: List<ContentGroup>? = null,
operation: DocumentableContentBuilder.(T) -> Unit
) {
if (renderWhenEmpty || elements.any()) {
header(level, name) { }
contents += ContentTable(
- emptyList(),
+ headers ?: defaultHeaders,
elements
.let {
if (needsSorting)
@@ -203,7 +195,7 @@ open class PageContentBuilder(
prefix: String = "",
suffix: String = "",
separator: String = ", ",
- sourceSets: Set<DokkaSourceSet> = mainPlatformData, // TODO: children should be aware of this platform data
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData, // TODO: children should be aware of this platform data
operation: DocumentableContentBuilder.(T) -> Unit
) {
if (elements.isNotEmpty()) {
@@ -221,7 +213,7 @@ open class PageContentBuilder(
text: String,
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -232,7 +224,7 @@ open class PageContentBuilder(
text: String,
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) = ContentDRILink(
@@ -246,7 +238,7 @@ open class PageContentBuilder(
text: String,
address: String,
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) =
@@ -262,7 +254,7 @@ open class PageContentBuilder(
fun link(
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
@@ -278,7 +270,7 @@ open class PageContentBuilder(
fun comment(
docTag: DocTag,
kind: Kind = ContentKind.Comment,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -292,7 +284,7 @@ open class PageContentBuilder(
fun group(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -318,7 +310,7 @@ open class PageContentBuilder(
fun buildGroup(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -327,7 +319,7 @@ open class PageContentBuilder(
fun sourceSetDependentHint(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<DokkaSourceSet> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainSourcesetData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -341,15 +333,15 @@ open class PageContentBuilder(
fun sourceSetDependentHint(
dri: DRI,
- platformData: Set<DokkaSourceSet> = mainPlatformData,
+ sourcesetData: Set<DokkaSourceSet> = mainSourcesetData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += PlatformHintedContent(
- buildGroup(setOf(dri), platformData, kind, styles, extra, block),
- platformData
+ buildGroup(setOf(dri), sourcesetData, kind, styles, extra, block),
+ sourcesetData
)
}
@@ -383,7 +375,7 @@ open class PageContentBuilder(
private val instances: MutableList<ContentDivergentInstance> = mutableListOf()
fun instance(
dri: Set<DRI>,
- sourceSets: Set<DokkaSourceSet>, // Having correct PlatformData is crucial here, that's why there's no default
+ sourceSets: Set<DokkaSourceSet>, // Having correct sourcesetData is crucial here, that's why there's no default
kind: Kind = mainKind,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,