diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-08-31 20:16:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 20:16:01 +0200 |
commit | 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch) | |
tree | 66f6d6f089a93b863bf1144666491eca6729ad05 /plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt | |
parent | 6a181a7a2b03ec263788d137610e86937a57d434 (diff) | |
download | dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2 dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip |
Enable explicit API mode (#3139)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt b/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt index f985e4d0..83d4b24f 100644 --- a/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt +++ b/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt @@ -16,19 +16,23 @@ import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.pages.PageTransformer -data class SearchRecord( +public data class SearchRecord( val name: String, val description: String? = null, val location: String, val searchKeys: List<String> = listOf(name) ) { - companion object + public companion object } -open class SearchbarDataInstaller(val context: DokkaContext) : PageTransformer { - data class DRIWithSourceSets(val dri: DRI, val sourceSet: Set<DisplaySourceSet>) - data class SignatureWithId(val driWithSourceSets: DRIWithSourceSets, val displayableSignature: String) { - constructor(dri: DRI, page: ContentPage) : this( DRIWithSourceSets(dri, page.sourceSets()), +public open class SearchbarDataInstaller( + public val context: DokkaContext +) : PageTransformer { + + public data class DRIWithSourceSets(val dri: DRI, val sourceSet: Set<DisplaySourceSet>) + + public data class SignatureWithId(val driWithSourceSets: DRIWithSourceSets, val displayableSignature: String) { + public constructor(dri: DRI, page: ContentPage) : this( DRIWithSourceSets(dri, page.sourceSets()), getSymbolSignature(page, dri)?.let { flattenToText(it) } ?: page.name) val id: String @@ -43,7 +47,10 @@ open class SearchbarDataInstaller(val context: DokkaContext) : PageTransformer { private val mapper = jacksonObjectMapper() - open fun generatePagesList(pages: List<SignatureWithId>, locationResolver: DriResolver): List<SearchRecord> = + public open fun generatePagesList( + pages: List<SignatureWithId>, + locationResolver: DriResolver + ): List<SearchRecord> = pages.map { pageWithId -> createSearchRecord( name = pageWithId.displayableSignature, @@ -57,7 +64,7 @@ open class SearchbarDataInstaller(val context: DokkaContext) : PageTransformer { ) }.sortedWith(compareBy({ it.name }, { it.description })) - open fun createSearchRecord( + public open fun createSearchRecord( name: String, description: String?, location: String, @@ -65,7 +72,7 @@ open class SearchbarDataInstaller(val context: DokkaContext) : PageTransformer { ): SearchRecord = SearchRecord(name, description, location, searchKeys) - open fun processPage(page: PageNode): List<SignatureWithId> = + public open fun processPage(page: PageNode): List<SignatureWithId> = when (page) { is ContentPage -> page.takeIf { page !is ModulePageNode && page !is PackagePageNode }?.dri ?.map { dri -> SignatureWithId(dri, page) }.orEmpty() |