aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-10-16 13:39:02 +0200
committerGitHub <noreply@github.com>2020-10-16 13:39:02 +0200
commitc482ed6e688cb9e5105aa0d686613c8ad81905fb (patch)
tree385a9bc8f8144c1c05af4ccccf08afbbd270b5ee /plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
parent991913dc02f342615f33511f96891e5db7487cd4 (diff)
downloaddokka-c482ed6e688cb9e5105aa0d686613c8ad81905fb.tar.gz
dokka-c482ed6e688cb9e5105aa0d686613c8ad81905fb.tar.bz2
dokka-c482ed6e688cb9e5105aa0d686613c8ad81905fb.zip
Explicit fallback in searchbar (#1559)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt24
1 files changed, 3 insertions, 21 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index b34d3d6e..fdb5be3c 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -1,17 +1,9 @@
package org.jetbrains.dokka.base.renderers.html
-import com.fasterxml.jackson.databind.annotation.JsonSerialize
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import kotlinx.html.h1
-import kotlinx.html.id
-import kotlinx.html.table
-import kotlinx.html.tbody
-import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration
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.DFunction
@@ -24,18 +16,8 @@ import org.jetbrains.dokka.transformers.pages.PageTransformer
object NavigationPageInstaller : PageTransformer {
private val mapper = jacksonObjectMapper()
- private data class NavigationNodeView(
- val name: String,
- val label: String = name,
- val searchKey: String = name,
- @get:JsonSerialize(using = ToStringSerializer::class) val dri: DRI,
- val location: String
- ) {
- companion object {
- fun from(node: NavigationNode, location: String): NavigationNodeView =
- NavigationNodeView(name = node.name, dri = node.dri, location = location)
- }
- }
+ fun SearchRecord.Companion.from(node: NavigationNode, location: String): SearchRecord =
+ SearchRecord(name = node.name, location = location)
override fun invoke(input: RootPageNode): RootPageNode {
val nodes = input.children.filterIsInstance<ContentPage>().single()
@@ -46,7 +28,7 @@ object NavigationPageInstaller : PageTransformer {
children = emptyList(),
strategy = RenderingStrategy.LocationResolvableWrite { resolver ->
mapper.writeValueAsString(
- nodes.withDescendants().map { NavigationNodeView.from(it, resolver(it.dri, it.sourceSets)) })
+ nodes.withDescendants().map { SearchRecord.from(it, resolver(it.dri, it.sourceSets)) })
})
return input.modified(