diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-06-03 09:30:28 +0200 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2020-06-12 14:15:24 +0200 |
commit | 3ca8ca75c60892de68f4fe18335aa79f4622c93c (patch) | |
tree | 19b4a936a602edfaf6eec8ec0882285e2af403fb /plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | |
parent | dd44b839eac1b7b647e97f2cc73dd96bd054713b (diff) | |
download | dokka-3ca8ca75c60892de68f4fe18335aa79f4622c93c.tar.gz dokka-3ca8ca75c60892de68f4fe18335aa79f4622c93c.tar.bz2 dokka-3ca8ca75c60892de68f4fe18335aa79f4622c93c.zip |
Stdlib wrapping in signature
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index 7f0e985e..f8141110 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -25,6 +25,7 @@ interface JvmSignatureUtils { private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, ignored: Set<Annotations.Annotation>, + styles: Set<Style>, operation: PageContentBuilder.DocumentableContentBuilder.(Annotations.Annotation) -> Unit ): Unit = when (d) { is DFunction -> d.annotations() @@ -42,7 +43,7 @@ interface JvmSignatureUtils { }?.let { it.entries.forEach { it.value.filter { it !in ignored }.takeIf { it.isNotEmpty() }?.let { annotations -> - group(sourceSets = setOf(it.key), styles = setOf(TextStyle.Block)) { + group(sourceSets = setOf(it.key), styles = styles) { annotations.forEach { operation(it) } @@ -65,13 +66,13 @@ interface JvmSignatureUtils { link(a.dri.classNames!!, a.dri) text("(") a.params.entries.forEachIndexed { i, it -> - group(styles = setOf(TextStyle.Span)) { + group(styles = setOf(TextStyle.BreakableAfter)) { text(it.key + " = ") when (renderAtStrategy) { is All -> All is Never, is OnlyOnce -> Never }.let { strategy -> - valueToSignature(it.value, strategy, listBrackets, classExtension) + valueToSignature(it.value, strategy, listBrackets, classExtension) } if (i != a.params.entries.size - 1) text(", ") } @@ -89,14 +90,16 @@ interface JvmSignatureUtils { is ArrayValue -> { text(listBrackets.first.toString()) a.value.forEachIndexed { i, it -> - valueToSignature(it, renderAtStrategy, listBrackets, classExtension) - if (i != a.value.size - 1) text(", ") + group(styles = setOf(TextStyle.BreakableAfter)) { + valueToSignature(it, renderAtStrategy, listBrackets, classExtension) + if (i != a.value.size - 1) text(", ") + } } text(listBrackets.second.toString()) } is EnumValue -> link(a.enumName, a.enumDri) is ClassValue -> link(a.className + classExtension, a.classDRI) - is StringValue -> text(a.value) + is StringValue -> group(styles = setOf(TextStyle.Breakable)) { text(a.value) } } fun PageContentBuilder.DocumentableContentBuilder.annotationsBlockWithIgnored( @@ -106,7 +109,7 @@ interface JvmSignatureUtils { listBrackets: Pair<Char, Char>, classExtension: String ) { - annotations(d, ignored) { + annotations(d, ignored, setOf(TextStyle.Block)) { group { toSignatureString(it, renderAtStrategy, listBrackets, classExtension) } @@ -120,7 +123,7 @@ interface JvmSignatureUtils { listBrackets: Pair<Char, Char>, classExtension: String ) { - annotations(d, ignored) { + annotations(d, ignored, setOf(TextStyle.Span)) { toSignatureString(it, renderAtStrategy, listBrackets, classExtension) text(Typography.nbsp.toString()) } |