aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-08-27 14:48:54 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-28 16:34:23 +0200
commit6d00ac775b77ce373a9a8d39eadeec32b155920a (patch)
tree3b4b48746f7ec127786fcea40fff52a254d3b6d7 /plugins/base/src/main/kotlin/renderers
parent9fe95458fff1abf711884abc3ec2f6da1b802a2b (diff)
downloaddokka-6d00ac775b77ce373a9a8d39eadeec32b155920a.tar.gz
dokka-6d00ac775b77ce373a9a8d39eadeec32b155920a.tar.bz2
dokka-6d00ac775b77ce373a9a8d39eadeec32b155920a.zip
Fix unstable ordering by sorting methods and entries in the searchbar
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt27
1 files changed, 10 insertions, 17 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt b/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt
index cd95013a..f953821f 100644
--- a/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/SearchbarDataInstaller.kt
@@ -1,20 +1,20 @@
package org.jetbrains.dokka.base.renderers.html
-import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.Platform
-import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.*
+import java.util.concurrent.ConcurrentHashMap
-class SearchbarDataInstaller() {
- private val pageList = mutableMapOf<String, Pair<String, String>>()
+class SearchbarDataInstaller {
+ private val pageList = ConcurrentHashMap<String, Pair<String, String>>()
- private fun String.escaped(): String = this.replace("'","\\'")
+ private fun String.escaped(): String = this.replace("'", "\\'")
- fun generatePagesList(): String {
- return pageList.entries
+ fun generatePagesList(): String =
+ pageList.entries
.filter { it.key.isNotEmpty() }
+ .sortedWith(compareBy({ it.key }, { it.value.first }, { it.value.second }))
.groupBy { it.key.substringAfterLast(".") }
.entries
.flatMapIndexed { topLevelIndex, entry ->
@@ -23,7 +23,6 @@ class SearchbarDataInstaller() {
}
}
.joinToString(prefix = "[", separator = ",\n", postfix = "]")
- }
private fun getSymbolSignature(page: ContentPage) = page.content.dfs { it.dci.kind == ContentKind.Symbol }
@@ -54,16 +53,10 @@ class SearchbarDataInstaller() {
documentable.dri.packageName,
documentable.dri.classNames,
documentable.dri.callable?.name
- )
- .filter { !it.isNullOrEmpty() }
+ ).filter { !it.isNullOrEmpty() }
.takeIf { it.isNotEmpty() }
?.joinToString(".")
- ?.let {
- pageList.put(it, Pair(textNodes ?: page.name, link))
- }
-
+ ?.let { id -> pageList.put(id, Pair(textNodes ?: page.name, link)) }
}
}
-
-
-} \ No newline at end of file
+}