Fix index sort order
authorLanius Trolling <lanius@laniustrolling.dev>
Sun, 19 Feb 2023 17:49:43 +0000 (12:49 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Sun, 19 Feb 2023 17:49:43 +0000 (12:49 -0500)
src/main/kotlin/info/mechyrdia/lore/article_listing.kt

index a67db387050abf5d2f05b0bd886e6cbb9960d1ff..5d4b78d3d2c459994af4aaf844606af8a883020b 100644 (file)
@@ -14,6 +14,12 @@ fun File.toArticleNode(): ArticleNode = ArticleNode(
                .orEmpty()
                .map { it.toArticleNode() }
                .sortedBy { it.name }
+               .sortedBy {
+                       if (it.subNodes.isNotEmpty())
+                               0
+                       else
+                               1
+               }
 )
 
 fun List<ArticleNode>.renderInto(list: UL, base: String? = null) {