WIP factbook links are now not rendered at all, instead of being rendered invisible
authorLanius Trolling <lanius@laniustrolling.dev>
Sun, 18 Jun 2023 13:45:53 +0000 (09:45 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Sun, 18 Jun 2023 13:45:53 +0000 (09:45 -0400)
src/main/kotlin/info/mechyrdia/lore/article_listing.kt

index 81c1029208dc37ea9365518c90c075ae46c34e23..8f98b6c5dcc09710e292e2de0968ca6062ef39ab 100644 (file)
@@ -1,7 +1,10 @@
 package info.mechyrdia.lore
 
 import info.mechyrdia.Configuration
-import kotlinx.html.*
+import kotlinx.html.UL
+import kotlinx.html.a
+import kotlinx.html.li
+import kotlinx.html.ul
 import java.io.File
 
 data class ArticleNode(val name: String, val subNodes: List<ArticleNode>)
@@ -18,16 +21,14 @@ fun File.toArticleNode(): ArticleNode = ArticleNode(
 fun List<ArticleNode>.renderInto(list: UL, base: String? = null) {
        val prefix = base?.let { "$it/" } ?: ""
        forEach { node ->
-               list.li {
-                       if (!Configuration.CurrentConfiguration.isDevMode && (node.name.endsWith(".wip") || node.name.endsWith(".old")))
-                               style = "display:none"
-                       
-                       a(href = "/lore/$prefix${node.name}") { +node.name }
-                       if (node.subNodes.isNotEmpty())
-                               ul {
-                                       node.subNodes.renderInto(this, "$prefix${node.name}")
-                               }
-               }
+               if (Configuration.CurrentConfiguration.isDevMode || !(node.name.endsWith(".wip") || node.name.endsWith(".old")))
+                       list.li {
+                               a(href = "/lore/$prefix${node.name}") { +node.name }
+                               if (node.subNodes.isNotEmpty())
+                                       ul {
+                                               node.subNodes.renderInto(this, "$prefix${node.name}")
+                                       }
+                       }
        }
 }