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>)
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}")
+ }
+ }
}
}