aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-08-20 17:44:22 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-21 15:40:12 +0200
commit1634c8a0184749ae9314adecf409851c35e93775 (patch)
treec7dc2da6d1275ab5be46ac32d786d4be454a4102 /plugins/base
parent3c07bc1966c85de3351602c4e8798fa507c40e49 (diff)
downloaddokka-1634c8a0184749ae9314adecf409851c35e93775.tar.gz
dokka-1634c8a0184749ae9314adecf409851c35e93775.tar.bz2
dokka-1634c8a0184749ae9314adecf409851c35e93775.zip
Make NavigationNode implement WithChildren
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt5
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt5
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
index f569ed12..24065e57 100644
--- a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
@@ -4,6 +4,7 @@ import kotlinx.html.*
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DisplaySourceSet
+import org.jetbrains.dokka.model.WithChildren
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RendererSpecificPage
import org.jetbrains.dokka.pages.RenderingStrategy
@@ -42,8 +43,8 @@ data class NavigationNode(
val name: String,
val dri: DRI,
val sourceSets: Set<DisplaySourceSet>,
- val children: List<NavigationNode>
-)
+ override val children: List<NavigationNode>
+): WithChildren<NavigationNode>
fun NavigationPage.transform(block: (NavigationNode) -> NavigationNode) = NavigationPage(root.transform(block))
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index 6e779931..f4c9a1f7 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -11,6 +11,7 @@ import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.model.DEnumEntry
+import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.pages.PageTransformer
@@ -61,9 +62,7 @@ object NavigationPageInstaller : PageTransformer {
name = "scripts/navigation-pane.json",
children = emptyList(),
strategy = RenderingStrategy.LocationResolvableWrite { resolver ->
- val flattened = flattenNavigationNodes(listOf(nodes))
- val view = flattened.map { NavigationNodeView.from(it, resolver(it.dri, it.sourceSets)) }
- mapper.writeValueAsString(view)
+ mapper.writeValueAsString(nodes.withDescendants().map { NavigationNodeView.from(it, resolver(it.dri, it.sourceSets)) })
})
return input.modified(