aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2019-11-05 17:20:21 +0100
committerPaweł Marks <pmarks@virtuslab.com>2019-11-05 17:28:56 +0100
commit940cf84196f0cd0dbeafae2f0ec5f73a49b68285 (patch)
tree2515a99b221641cb67c9a32ab109f13c7c3f1e73 /core/src/main/kotlin/transformers
parentab7333e7ffe6fbfda4e55fcc168dc00eece3f7f8 (diff)
downloaddokka-940cf84196f0cd0dbeafae2f0ec5f73a49b68285.tar.gz
dokka-940cf84196f0cd0dbeafae2f0ec5f73a49b68285.tar.bz2
dokka-940cf84196f0cd0dbeafae2f0ec5f73a49b68285.zip
Signateures wrapped in symbols
Diffstat (limited to 'core/src/main/kotlin/transformers')
-rw-r--r--core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
index 0427b9b6..a3966d62 100644
--- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
+++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
@@ -111,6 +111,10 @@ class DefaultDocumentationToPageTransformer(
contents += ContentText(text, platformData)
}
+ inline fun symbol(block: ContentBuilder.() -> Unit) {
+ contents += ContentSymbol(content(block), platformData)
+ }
+
inline fun <T> block(name: String, elements: Iterable<T>, block: ContentBuilder.(T) -> Unit) {
contents += ContentBlock(name, content { elements.forEach { block(it) } }, platformData)
}
@@ -152,10 +156,10 @@ class DefaultDocumentationToPageTransformer(
ContentBuilder(platformData).apply(block).build()
// When builder is made public it will be moved as extension method to someplace near Function model
- private fun ContentBuilder.signature(f: Function) {
+ private fun ContentBuilder.signature(f: Function) = symbol {
text("fun ")
if (f.receiver is Parameter) {
- type(f.receiver.descriptor.type)
+ type(f.receiver.descriptor.type)
text(".")
}
link(f.name, f.dri)
@@ -166,6 +170,12 @@ class DefaultDocumentationToPageTransformer(
type(it.descriptor.type)
}
text(")")
+ val returnType = f.descriptor.returnType
+ if (returnType != null &&
+ returnType.constructor.declarationDescriptor?.fqNameSafe?.asString() != Unit::class.qualifiedName) {
+ text(": ")
+ type(returnType)
+ }
}
private fun ContentBuilder.type(t: KotlinType) {