import kotlin.collections.set
suspend fun ApplicationCall.standardNavBar(path: List<String>? = null) = listOf(
+ NavLink("/", "Intro"),
NavLink("/lore", "Lore Index")
) + path?.let { pathParts ->
pathParts.dropLast(1).mapIndexed { i, part ->
import kotlinx.html.*
import java.io.File
+private const val INTRO_TITLE = "Welcome to Mechyrdia"
+private const val INTRO_COMMENTS_PATH = "/"
+
+suspend fun ApplicationCall.loreIntroPage(): HTML.() -> Unit {
+ val totalsData = processGuestbook()
+
+ val (canCommentAs, comments) = coroutineScope {
+ val canCommentAs = async { currentNation() }
+ val comments = async {
+ CommentRenderData(Comment.getCommentsIn(INTRO_COMMENTS_PATH).toList(), nationCache)
+ }
+
+ canCommentAs.await() to comments.await()
+ }
+
+ val sidebar = PageNavSidebar(
+ listOf(
+ NavLink("#page-top", INTRO_TITLE, aClasses = "left"),
+ NavLink("#comments", "Comments", aClasses = "left")
+ )
+ )
+
+ val htmlFile = File(Configuration.CurrentConfiguration.articleDir).parentFile.combineSafe("intro.html")
+ val fileHtml = htmlFile.readText()
+
+ return page(INTRO_TITLE, standardNavBar(), sidebar) {
+ section {
+ a { id = "page-top" }
+ unsafe { raw(fileHtml) }
+ }
+
+ finalSection(INTRO_COMMENTS_PATH, canCommentAs, comments, totalsData)
+ }
+}
+
suspend fun ApplicationCall.loreArticlePage(): HTML.() -> Unit {
val totalsData = processGuestbook()