aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-08-25 20:55:41 +0200
committerGitHub <noreply@github.com>2021-08-25 20:55:41 +0200
commitf2adc0a50462a63f7e1901db2e58077001acd622 (patch)
treea0a21d3c99b2d8cbe77ebf95d865aabd36d6598f /plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
parent939cbcd4d867961516da71f7c55d037ec88cb7f3 (diff)
parentefc9f92b0ac083c73ac494c95b530305ac04115a (diff)
downloaddokka-f2adc0a50462a63f7e1901db2e58077001acd622.tar.gz
dokka-f2adc0a50462a63f7e1901db2e58077001acd622.tar.bz2
dokka-f2adc0a50462a63f7e1901db2e58077001acd622.zip
Merge pull request #2066 from Kotlin/webhelp-like-frontend
Webhelp like frontend
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt')
-rw-r--r--plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt25
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
index d17fa276..94af96e2 100644
--- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
+++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
@@ -8,7 +8,6 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.signatures.KotlinSignatureUtils.drisOfAllNestedBounds
import org.jetbrains.dokka.model.AnnotationTarget
-import org.jetbrains.dokka.model.doc.DocumentationNode
interface JvmSignatureUtils {
@@ -80,21 +79,22 @@ interface JvmSignatureUtils {
when (renderAtStrategy) {
is All, is OnlyOnce -> {
- text("@")
when(a.scope) {
- Annotations.AnnotationScope.GETTER -> text("get:")
- Annotations.AnnotationScope.SETTER -> text("set:")
+ Annotations.AnnotationScope.GETTER -> text("@get:", styles = mainStyles + TokenStyle.Annotation)
+ Annotations.AnnotationScope.SETTER -> text("@set:", styles = mainStyles + TokenStyle.Annotation)
+ else -> text("@", styles = mainStyles + TokenStyle.Annotation)
}
+ link(a.dri.classNames!!, a.dri, styles = mainStyles + TokenStyle.Annotation)
}
- is Never -> Unit
+ is Never -> link(a.dri.classNames!!, a.dri)
}
- link(a.dri.classNames!!, a.dri)
val isNoWrappedBrackets = a.params.entries.isEmpty() && renderAtStrategy is OnlyOnce
listParams(
a.params.entries,
if (isNoWrappedBrackets) null else Pair('(', ')')
) {
- text(it.key + " = ")
+ text(it.key)
+ text(" = ", styles = mainStyles + TokenStyle.Operator)
when (renderAtStrategy) {
is All -> All
is Never, is OnlyOnce -> Never
@@ -116,8 +116,9 @@ interface JvmSignatureUtils {
}
is EnumValue -> link(a.enumName, a.enumDri)
is ClassValue -> link(a.className + classExtension, a.classDRI)
- is StringValue -> group(styles = setOf(TextStyle.Breakable)) { text( "\"${a.text()}\"") }
- is LiteralValue -> group(styles = setOf(TextStyle.Breakable)) { text(a.text()) }
+ is StringValue -> group(styles = setOf(TextStyle.Breakable)) { stringLiteral( "\"${a.text()}\"") }
+ is BooleanValue -> group(styles = setOf(TextStyle.Breakable)) { booleanLiteral(a.value) }
+ is LiteralValue -> group(styles = setOf(TextStyle.Breakable)) { constant(a.text()) }
}
private fun<T> PageContentBuilder.DocumentableContentBuilder.listParams(
@@ -125,14 +126,14 @@ interface JvmSignatureUtils {
listBrackets: Pair<Char, Char>?,
outFn: PageContentBuilder.DocumentableContentBuilder.(T) -> Unit
) {
- listBrackets?.let{ text(it.first.toString()) }
+ listBrackets?.let{ punctuation(it.first.toString()) }
params.forEachIndexed { i, it ->
group(styles = setOf(TextStyle.BreakableAfter)) {
this.outFn(it)
- if (i != params.size - 1) text(", ")
+ if (i != params.size - 1) punctuation(", ")
}
}
- listBrackets?.let{ text(it.second.toString()) }
+ listBrackets?.let{ punctuation(it.second.toString()) }
}
fun PageContentBuilder.DocumentableContentBuilder.annotationsBlockWithIgnored(