Skip to content

Commit 0405db8

Browse files
authored
[pkl-doc] Sort stdlib first on the main page (#165)
1 parent 3d1db25 commit 0405db8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ internal class MainPageGenerator(
6767
private fun HtmlBlockTag.renderPackages() {
6868
if (packagesData.isEmpty()) return
6969

70+
val sortedPackages =
71+
packagesData.sortedWith { pkg1, pkg2 ->
72+
when {
73+
pkg1.ref.pkg == "pkl" -> -1 // always sort the stdlib first
74+
else -> pkg1.ref.pkg.compareTo(pkg2.ref.pkg)
75+
}
76+
}
77+
7078
div {
7179
classes = setOf("member-group")
7280

@@ -79,7 +87,7 @@ internal class MainPageGenerator(
7987
}
8088

8189
ul {
82-
for (pkg in packagesData) {
90+
for (pkg in sortedPackages) {
8391
val packageScope =
8492
pageScope.packageScopes[pkg.ref.pkg]
8593
// create scope for previously generated package

0 commit comments

Comments
 (0)