aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Marks <pmarks@virtuslab.com>2019-11-04 14:57:55 +0100
committerPaweł Marks <pmarks@virtuslab.com>2019-11-04 14:57:55 +0100
commit93af17aba8858806f197a7e8b8383566a1debdeb (patch)
treed049d9bd188150679c447b01b71d597720fe7b8c
parent86446ac53fc691a5f894e66e0608b67bbf1c3b60 (diff)
downloaddokka-93af17aba8858806f197a7e8b8383566a1debdeb.tar.gz
dokka-93af17aba8858806f197a7e8b8383566a1debdeb.tar.bz2
dokka-93af17aba8858806f197a7e8b8383566a1debdeb.zip
Adds comments to pageModel
-rw-r--r--core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt18
-rw-r--r--core/src/main/kotlin/transformers/DocumentationToPageTransformer.kt3
2 files changed, 11 insertions, 10 deletions
diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
index c3236f14..ce4691b6 100644
--- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
+++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
@@ -9,10 +9,10 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
class DefaultDocumentationToPageTransformer: DocumentationToPageTransformer {
- override fun transform(modules: Collection<Pair<DokkaConfiguration.PassConfiguration, DocumentationNode<*>>>): PageNode {
+ override fun transform(modules: Collection<Pair<DokkaConfiguration.PassConfiguration, Module>>): PageNode {
val module = modules.first().second // TODO only one module for starters
val platformData = modules.first().first.targets.map { PlatformData(it, modules.first().first.analysisPlatform) }
- return PageBuilder(platformData).pageForModule(module as Module)
+ return PageBuilder(platformData).pageForModule(module)
}
class PageBuilder(private val platformData: List<PlatformData>) {
@@ -56,14 +56,14 @@ class DefaultDocumentationToPageTransformer: DocumentationToPageTransformer {
ContentBlock("Types", p.classes.map { ContentGroup(
listOf(
ContentLink(it.name, it.dri, platformData),
- ContentText("comment from class", platformData),
+ ContentText(it.briefDocstring, platformData),
ContentText("signature for class", platformData)
), platformData)
}, platformData),
ContentBlock("Functions", p.functions.map { ContentGroup(
listOf(
ContentLink(it.name, it.dri, platformData),
- ContentText("comment for function", platformData),
+ ContentText(it.briefDocstring, platformData),
ContentText("signature for function", platformData)
), platformData)
}, platformData)
@@ -71,18 +71,18 @@ class DefaultDocumentationToPageTransformer: DocumentationToPageTransformer {
private fun contentForClass(c: Class) = listOf(
ContentHeader(listOf(ContentText(c.name, platformData)), 1, platformData),
- ContentText("comment for class", platformData),
+ ContentText(c.rawDocstring, platformData),
ContentBlock("Constructors", c.descriptor.constructors.map { ContentGroup(
listOf(
ContentLink(it.fqNameSafe.asString(), c.dri.copy(callable = Callable(it.fqNameSafe.asString() /* TODO: identifier for filename here */, "", "", it.valueParameters.map {it.fqNameSafe.asString()})), platformData),
- ContentText("comment from constructor", platformData),
+ ContentText("message to Pawel from the future: you forgot about extracting constructors, didn't you?", platformData),
ContentText("signature for constructor", platformData)
), platformData)
}, platformData),
ContentBlock("Functions", c.functions.map { ContentGroup(
listOf(
ContentLink(it.name, it.dri, platformData),
- ContentText("comment for function", platformData),
+ ContentText(it.briefDocstring, platformData),
ContentText("signature for function", platformData)
), platformData)
}, platformData)
@@ -91,11 +91,11 @@ class DefaultDocumentationToPageTransformer: DocumentationToPageTransformer {
private fun contentForFunction(f: Function) = listOf(
ContentHeader(listOf(ContentText(f.name, platformData)), 1, platformData),
ContentText("signature for function", platformData),
- ContentText("comment for function", platformData),
+ ContentText(f.rawDocstring, platformData),
ContentBlock("Parameters", f.parameters.map { ContentGroup(
listOf(
ContentText(it.name ?: "?", platformData),
- ContentText("comment from param", platformData)
+ ContentText(it.rawDocstring, platformData)
), platformData)
}, platformData)
)
diff --git a/core/src/main/kotlin/transformers/DocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DocumentationToPageTransformer.kt
index 6cbcada9..f75f8d8e 100644
--- a/core/src/main/kotlin/transformers/DocumentationToPageTransformer.kt
+++ b/core/src/main/kotlin/transformers/DocumentationToPageTransformer.kt
@@ -2,8 +2,9 @@ package org.jetbrains.dokka.transformers
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.Model.DocumentationNode
+import org.jetbrains.dokka.Model.Module
import org.jetbrains.dokka.pages.PageNode
interface DocumentationToPageTransformer {
- fun transform (modules: Collection<Pair<DokkaConfiguration.PassConfiguration, DocumentationNode<*>>>): PageNode // TODO refactor this
+ fun transform (modules: Collection<Pair<DokkaConfiguration.PassConfiguration, Module>>): PageNode // TODO refactor this
} \ No newline at end of file