diff options
author | Andrey Tyrin <andrei.tyrin@jetbrains.com> | 2023-01-09 13:28:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-09 13:28:05 +0100 |
commit | c3aa879c3c77233c401cf314d736bf20891991ba (patch) | |
tree | 8f5ee6cff051069f72f88b6d86c9339ce02d599f /plugins/base/src/test/kotlin/utils/contentUtils.kt | |
parent | 5ad955f28bde39d2f9e972bd3ec2c341579d9474 (diff) | |
download | dokka-c3aa879c3c77233c401cf314d736bf20891991ba.tar.gz dokka-c3aa879c3c77233c401cf314d736bf20891991ba.tar.bz2 dokka-c3aa879c3c77233c401cf314d736bf20891991ba.zip |
Move inheritors, params, see also and samples tabs to description for classlikes (#2749)
Diffstat (limited to 'plugins/base/src/test/kotlin/utils/contentUtils.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/utils/contentUtils.kt | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt index 9f024c5b..d38af3f4 100644 --- a/plugins/base/src/test/kotlin/utils/contentUtils.kt +++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt @@ -1,9 +1,9 @@ package utils import matchers.content.* -import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.ContentGroup -import kotlin.text.Typography.nbsp +import org.jetbrains.dokka.pages.ContentPage +import org.jetbrains.dokka.pages.RootPageNode //TODO: Try to unify those functions after update to 1.4 fun ContentMatcherBuilder<*>.functionSignature( @@ -68,6 +68,53 @@ fun ContentMatcherBuilder<*>.bareSignature( } } +fun ContentMatcherBuilder<*>.classSignature( + annotations: Map<String, Set<String>>, + visibility: String, + modifier: String, + keywords: Set<String>, + name: String, + vararg params: Pair<String, ParamAttributes>, + parent: String? = null +) = group { + annotations.entries.forEach { + group { + unwrapAnnotation(it) + } + } + if (visibility.isNotBlank()) +"$visibility " + if (modifier.isNotBlank()) +"$modifier " + +("${keywords.joinToString("") { "$it " }}class ") + link { +name } + if (params.isNotEmpty()) { + +"(" + group { + params.forEachIndexed { id, (n, t) -> + group { + t.annotations.forEach { + unwrapAnnotation(it) + } + t.keywords.forEach { + +it + } + + +"$n: " + group { link { +(t.type) } } + if (id != params.lastIndex) + +", " + } + } + } + +")" + } + if (parent != null) { + +(" : ") + link { + +(parent) + } + } +} + fun ContentMatcherBuilder<*>.functionSignatureWithReceiver( annotations: Map<String, Set<String>>, visibility: String?, @@ -272,3 +319,6 @@ data class ParamAttributes( val keywords: Set<String>, val type: String ) + +fun RootPageNode.findTestType(packageName: String, name: String) = + children.single { it.name == packageName }.children.single { it.name == name } as ContentPage
\ No newline at end of file |