Make same-page fragment links easier
authorLanius Trolling <lanius@laniustrolling.dev>
Sun, 6 Oct 2024 19:29:26 +0000 (15:29 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Sun, 6 Oct 2024 19:29:26 +0000 (15:29 -0400)
src/jvmMain/kotlin/info/mechyrdia/auth/WebDav.kt
src/jvmMain/kotlin/info/mechyrdia/data/ViewsUser.kt
src/jvmMain/kotlin/info/mechyrdia/lore/ParserHtml.kt
src/jvmMain/kotlin/info/mechyrdia/lore/ViewOg.kt
src/jvmMain/kotlin/info/mechyrdia/robot/ViewsRobot.kt

index 9f9175604c2d47dbeae1e4e38d871dceeaec7672..92c8d9757b4e1559f5971bbb118d6304973263d9 100644 (file)
@@ -19,19 +19,7 @@ import info.mechyrdia.route.href
 import info.mechyrdia.route.installCsrfToken
 import io.ktor.server.application.ApplicationCall
 import kotlinx.coroutines.flow.toList
-import kotlinx.html.FormMethod
-import kotlinx.html.HTML
-import kotlinx.html.div
-import kotlinx.html.form
-import kotlinx.html.h1
-import kotlinx.html.p
-import kotlinx.html.style
-import kotlinx.html.submitInput
-import kotlinx.html.table
-import kotlinx.html.td
-import kotlinx.html.textInput
-import kotlinx.html.th
-import kotlinx.html.tr
+import kotlinx.html.*
 import kotlinx.serialization.SerialName
 import kotlinx.serialization.Serializable
 import java.time.Instant
index 64c89d784543e1084fd7436f1b7c027b11299cea..5f814e177e21fcd7932d3a19408946a1dac2a11a 100644 (file)
@@ -15,12 +15,7 @@ import io.ktor.server.application.ApplicationCall
 import io.ktor.server.sessions.get
 import io.ktor.server.sessions.sessions
 import kotlinx.coroutines.flow.toList
-import kotlinx.html.HTML
-import kotlinx.html.a
-import kotlinx.html.h1
-import kotlinx.html.id
-import kotlinx.html.p
-import kotlinx.html.section
+import kotlinx.html.*
 
 fun ApplicationCall.currentUserPage(): Nothing {
        val currNationId = sessions.get<UserSession>()?.nationId
index 0f48b04d272897a963193ff0e7917e41e4e356b2..f5f6255acfac78d35d6ed1657052f57a903c455d 100644 (file)
@@ -369,7 +369,7 @@ fun processTableCell(param: String?): Map<String, String> {
        return width?.let { mapOf("colspan" to "$it") }.orEmpty() + height?.let { mapOf("rowspan" to "$it") }.orEmpty()
 }
 
-fun String.toInternalUrl() = if (startsWith("/")) "/lore$this" else "./$this"
+fun String.toInternalUrl() = if (startsWith("/")) "/lore$this" else if (startsWith("#")) this else "./$this"
 fun String.toExternalUrl() = if (startsWith("http:")) "https:${substring(5)}" else this
 
 fun processInternalLink(param: String?): Map<String, String> = param
index 9d880da91148620f814a790b6b74a562cc1230d6..2e22be2d4373986d73c03e96166445752685c5e1 100644 (file)
@@ -3,8 +3,7 @@ package info.mechyrdia.lore
 import info.mechyrdia.MainDomainName
 import io.ktor.server.application.ApplicationCall
 import io.ktor.server.request.path
-import kotlinx.html.HEAD
-import kotlinx.html.meta
+import kotlinx.html.*
 import kotlinx.serialization.Serializable
 
 @Serializable
index b6a2c089baf58446001012ce37356f514d0ca8e4..4541e68216b04cfb56a145f367bae7c3a303d9f3 100644 (file)
@@ -19,18 +19,7 @@ import io.ktor.websocket.Frame
 import io.ktor.websocket.WebSocketSession
 import io.ktor.websocket.close
 import io.ktor.websocket.readText
-import kotlinx.html.FormMethod
-import kotlinx.html.HTML
-import kotlinx.html.b
-import kotlinx.html.form
-import kotlinx.html.h1
-import kotlinx.html.li
-import kotlinx.html.main
-import kotlinx.html.p
-import kotlinx.html.section
-import kotlinx.html.span
-import kotlinx.html.submitInput
-import kotlinx.html.ul
+import kotlinx.html.*
 
 suspend fun ApplicationCall.robotPage(): HTML.() -> Unit {
        val nation = currentNation()?.id ?: redirectHrefWithError(Root.Auth.LoginPage(), error = "You must be logged in to use the NUKE")