diff options
Diffstat (limited to 'core/src/main/kotlin/pages/PageBuilder.kt')
-rw-r--r-- | core/src/main/kotlin/pages/PageBuilder.kt | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index 92e2c5fe..8951219a 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.pages +import model.doc.DocType import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Function @@ -29,7 +30,7 @@ class DefaultPageBuilder( else -> throw IllegalStateException("$m should not be present here") } - private fun group(node: DocumentationNode, content: PageContentBuilderFunction) = + private fun group(node: Documentable, content: PageContentBuilderFunction) = rootContentGroup(node, ContentKind.Main, content) private fun contentForModule(m: Module) = group(m) { @@ -60,7 +61,13 @@ class DefaultPageBuilder( header(2) { text("SuperInterfaces") } linkTable(it) } - c.commentsData.forEach { (doc, links) -> comment(doc, links) } + c.commentsData.forEach { + it.children.forEach { + header(3) { text(it.toHeaderString()) } + comment(it.root) + text("\n") + } + } block("Constructors", 2, ContentKind.Functions, c.constructors, c.platformData) { link(it.name, it.dri) signature(it) @@ -71,20 +78,26 @@ class DefaultPageBuilder( signature(it) text(it.briefDocstring) } + block("Properties", 2, ContentKind.Properties, c.properties, c.platformData) { + link(it.name, it.dri) + text(it.briefDocstring) + } } private fun contentForFunction(f: Function) = group(f) { header(1) { text(f.name) } signature(f) - f.commentsData.forEach { (doc, links) -> markdown(doc, links) } + f.commentsData.forEach { it.children.forEach { comment(it.root) } } block("Parameters", 2, ContentKind.Parameters, f.children, f.platformData) { text(it.name ?: "<receiver>") - it.commentsData.forEach { (doc, links) -> markdown(doc, links) } + it.commentsData.forEach { it.children.forEach { comment(it.root) } } } } + + private fun DocType.toHeaderString() = this.javaClass.toGenericString().split('.').last() } -typealias RootContentBuilder = (DocumentationNode, Kind, PageContentBuilderFunction) -> ContentGroup +typealias RootContentBuilder = (Documentable, Kind, PageContentBuilderFunction) -> ContentGroup interface PageBuilder { val rootContentGroup: RootContentBuilder |