aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt3
-rw-r--r--core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt5
-rw-r--r--core/src/main/kotlin/transformers/TopDownPageNodeMerger.kt16
3 files changed, 16 insertions, 8 deletions
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index 065b669a..bf4090f4 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -35,7 +35,8 @@ open class HtmlRenderer(fileWriter: FileWriter, locationProvider: LocationProvid
"<td>" + children.filterNot { it is ContentLink }.joinToString("\n") { it.build(pageContext) }
override fun buildBlock(name: String, content: List<ContentNode>, pageContext: PageNode): String =
- buildHeader(3, name) + "<table>\n<tr>\n<td>\n" + content.joinToString("</td>\n</tr>\n<tr>\n<td>") { it.build(pageContext) } + "</td></tr>\n</table>"
+ buildHeader(3, name) + "<table>\n<tr>\n<td>\n" +
+ content.joinToString("</td>\n</tr>\n<tr>\n<td>") { "(" + it.dci.platformDataList.map {it.platformName}.joinToString() + ") " + it.build(pageContext) } + "</td></tr>\n</table>"
override fun renderPage(page: PageNode) {
val pageText = buildStartHtml(page) + buildPageContent(page) + buildEndHtml()
diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
index ee86613b..5db50e35 100644
--- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
+++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt
@@ -65,8 +65,8 @@ class DefaultDocumentationToPageTransformer(
}
block("Functions", p.functions) {
link(it.name, it.dri)
- text(it.briefDocstring)
signature(it)
+ text(it.briefDocstring)
}
}
@@ -74,13 +74,14 @@ class DefaultDocumentationToPageTransformer(
header(1) { text(c.name) }
c.rawDocstrings.forEach { markdown(it, c) }
block("Constructors", c.constructors) {
+ link(it.name, it.dri)
signature(it)
text(it.briefDocstring)
}
block("Functions", c.functions) {
link(it.name, it.dri)
- text(it.briefDocstring)
signature(it)
+ text(it.briefDocstring)
}
}
diff --git a/core/src/main/kotlin/transformers/TopDownPageNodeMerger.kt b/core/src/main/kotlin/transformers/TopDownPageNodeMerger.kt
index 36e543b3..7d6d33b7 100644
--- a/core/src/main/kotlin/transformers/TopDownPageNodeMerger.kt
+++ b/core/src/main/kotlin/transformers/TopDownPageNodeMerger.kt
@@ -29,16 +29,22 @@ class TopDownPageNodeMerger {
- private fun List<ContentBlock>.mergeContent(): List<ContentNode> =
- this.flatMap { it.children }.groupBy { it.dci.dri }.flatMap { (_, list) -> list.mergeList() }
+ private fun List<ContentBlock>.mergeContent(): ContentBlock =
+ ContentBlock(this.first().name, this.flatMap { it.children }.groupBy { it.dci.dri }.flatMap { (_, list) -> list.mergeList() }, DCI(this.first().dci.dri, this.flatMap { it.dci.platformDataList }.distinct()), this.flatMap { it.annotations })
private fun List<ContentNode>.mergeList(): List<ContentNode> =
this.groupBy { it::class }.flatMap { (_, list) ->
val thisClass = list.first()
+ val newDCI = DCI(thisClass.dci.dri, list.flatMap { it.dci.platformDataList }.distinct())
when(thisClass) {
- is ContentBlock -> listOf(ContentBlock(thisClass.name, (list as List<ContentBlock>).mergeContent(), thisClass.dci, list.flatMap { it.annotations }.distinct()))
- else -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "")}
+ is ContentBlock -> list.groupBy{ (it as ContentBlock).name }.map { (it.value as List<ContentBlock>).mergeContent() } //(ContentBlock(thisClass.name, (list as List<ContentBlock>).mergeContent(), newDCI, list.flatMap { it.annotations }.distinct()))
+ is ContentHeader -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentHeader).copy(dci = newDCI)}
+ is ContentStyle -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentStyle).copy(dci = newDCI)}
+ is ContentSymbol -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentSymbol).copy(dci = newDCI)}
+ is ContentComment -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentComment).copy(dci = newDCI)}
+ is ContentGroup -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentGroup).copy(dci = newDCI)}
+ is ContentList -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }.map { (it as ContentList).copy(dci = newDCI)}
+ else -> list.distinctBy { it.toString().replace("dci=.*,".toRegex(), "") }
}
}
-
} \ No newline at end of file