diff options
3 files changed, 11 insertions, 6 deletions
diff --git a/core/src/main/kotlin/DokkaDescriptorVisitor.kt b/core/src/main/kotlin/DokkaDescriptorVisitor.kt index 979acdc5..ac54635b 100644 --- a/core/src/main/kotlin/DokkaDescriptorVisitor.kt +++ b/core/src/main/kotlin/DokkaDescriptorVisitor.kt @@ -36,6 +36,7 @@ object DokkaDescriptorVisitor : DeclarationDescriptorVisitorEmptyBodies<Document return Class( dri, descriptor.name.asString(), + descriptor.constructors.map { visitConstructorDescriptor(it, dri) }, scope.functions(dri), scope.properties(dri), scope.classes(dri), @@ -67,6 +68,11 @@ object DokkaDescriptorVisitor : DeclarationDescriptorVisitorEmptyBodies<Document ) } + override fun visitConstructorDescriptor( + descriptor: ConstructorDescriptor, + parent: DRI + ) = visitFunctionDescriptor(descriptor, parent) + override fun visitReceiverParameterDescriptor( descriptor: ReceiverParameterDescriptor, parent: DRI diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt index 48bad7eb..62228556 100644 --- a/core/src/main/kotlin/Model/DocumentationNode.kt +++ b/core/src/main/kotlin/Model/DocumentationNode.kt @@ -26,6 +26,7 @@ class Package( class Class( override val dri: DRI, val name: String, + val constructors: List<Function>, override val functions: List<Function>, override val properties: List<Property>, override val classes: List<Class>, diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt index 54fd9a27..cae1d652 100644 --- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt +++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt @@ -35,7 +35,7 @@ class DefaultDocumentationToPageTransformer( private fun pageForClass(c: Class, parent: PageNode): ClassPageNode = ClassPageNode(c.name, contentForClass(c), parent, c.dri, c).apply { - // TODO: Pages for constructors + appendChildren(c.constructors.map { pageForMember(it, this) }) appendChildren(c.classes.map { pageForClass(it, this) }) appendChildren(c.functions.map { pageForMember(it, this) }) appendChildren(c.properties.map { pageForMember(it, this) }) @@ -72,11 +72,9 @@ class DefaultDocumentationToPageTransformer( private fun contentForClass(c: Class) = content(platformData) { header(1) { text(c.name) } markdown(c.rawDocstring, c) - text("PING PAWEL TO ADD CONSTRUCTORS TO MODEL!!!") - block("Constructors", emptyList<Function>() /* TODO: CONSTRUCTORS*/) { - link(it.name, it.dri) + block("Constructors", c.constructors) { + link("signature for constructor", it.dri) text(it.briefDocstring) - text("message to Pawel from the future: you forgot about extracting constructors, didn't you?") } block("Functions", c.functions) { link(it.name, it.dri) @@ -91,7 +89,7 @@ class DefaultDocumentationToPageTransformer( markdown(f.rawDocstring, f) block("Parameters", f.children) { group { - text(it.name ?: "RECEIVER") + text(it.name ?: "<receiver>") markdown(it.rawDocstring, it) } } |