aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt8
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt9
2 files changed, 14 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index b69f60d2..bc3f79c8 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -180,7 +180,7 @@ open class DefaultPageCreator(
}
}
if (c is DEnum) {
- block("Entries", 2, ContentKind.Classlikes, c.entries, c.sourceSets.toSet(), extra = mainExtra + SimpleAttr.header("Entries"), styles = emptySet()) {
+ block("Entries", 2, ContentKind.Classlikes, c.entries, c.sourceSets.toSet(), needsSorting = false, extra = mainExtra + SimpleAttr.header("Entries"), styles = emptySet()) {
link(it.name, it.dri)
sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
contentForBrief(it)
@@ -201,6 +201,7 @@ open class DefaultPageCreator(
(this[T::class] as List<Pair<SourceSetData, T>>?)
?.groupBy { it.second.name }
?.mapValues { (_, v) -> v.toMap() }
+ ?.toSortedMap(String.CASE_INSENSITIVE_ORDER)
.orEmpty()
private inline fun <reified T : TagWrapper> GroupedTags.isNotEmptyForTag(): Boolean =
@@ -377,7 +378,10 @@ open class DefaultPageCreator(
if (collection.any()) {
header(2, name)
table(kind, extra = extra) {
- collection.groupBy { it.name }.map { (elementName, elements) -> // This groupBy should probably use LocationProvider
+ collection
+ .groupBy { it.name }
+ .toSortedMap(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)){it})
+ .map { (elementName, elements) -> // This groupBy should probably use LocationProvider
buildGroup(elements.map { it.dri }.toSet(), elements.flatMap { it.sourceSets }.toSet(), kind = kind) {
link(elementName.orEmpty(), elements.first().dri, kind = kind)
divergentGroup(
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index cbae588f..9d10620e 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -172,13 +172,20 @@ open class PageContentBuilder(
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
renderWhenEmpty: Boolean = false,
+ needsSorting: Boolean = true,
operation: DocumentableContentBuilder.(T) -> Unit
) {
if (renderWhenEmpty || elements.any()) {
header(level, name) { }
contents += ContentTable(
emptyList(),
- elements.map {
+ elements
+ .let{
+ if (needsSorting)
+ it.sortedWith(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)){ it.name })
+ else it
+ }
+ .map {
buildGroup(setOf(it.dri), it.sourceSets.toSet(), kind, styles, extra) {
operation(it)
}