import info.mechyrdia.lore.TextParserCommentTags
import info.mechyrdia.lore.TextParserState
import info.mechyrdia.lore.dateTime
+import info.mechyrdia.lore.toFriendlyIndexTitle
import info.mechyrdia.route.Root
import info.mechyrdia.route.href
import info.mechyrdia.route.installCsrfToken
style = "font-size:1.5em;margin-top:2.5em"
+"On factbook "
a(href = href(Root.LorePage(comment.submittedIn))) {
- +comment.submittedIn.joinToString(separator = "/")
+ +comment.submittedIn.toFriendlyIndexTitle()
}
}
for (node in this) {
if (node.isViewable)
list.li {
- a(href = href(Root.LorePage(base + node.name, format))) { +node.name }
+ val nodePath = base + node.name
+ a(href = href(Root.LorePage(nodePath, format))) { +node.name.toFriendlyPageTitle() }
if (node.subNodes.isNotEmpty())
ul {
- node.subNodes.renderInto(this, base + node.name, format)
+ node.subNodes.renderInto(this, nodePath, format)
}
}
}
}
-fun String.toFriendlyIndexTitle() = split('/').joinToString(separator = " - ") { part ->
+fun List<String>.toFriendlyIndexTitle() = joinToString(separator = " - ") { part ->
part.toFriendlyPageTitle()
}
-fun String.toFriendlyPageTitle() = split('-')
- .joinToString(separator = " ") { word ->
- word.lowercase().replaceFirstChar { it.titlecase() }
- }
+fun String.toFriendlyIndexTitle() = split('/').toFriendlyIndexTitle()
+
+fun String.toFriendlyPageTitle() = split('-').joinToString(separator = " ") { word ->
+ word.lowercase().replaceFirstChar { it.titlecase() }
+}
) + path?.let { pathParts ->
pathParts.dropLast(1).mapIndexed { i, part ->
val subPath = pathParts.take(i + 1)
- NavLink(href(Root.LorePage(subPath)), part)
+ NavLink(href(Root.LorePage(subPath)), part.toFriendlyPageTitle())
}
}.orEmpty() + (currentNation()?.let { data ->
listOf(
private fun List<ArticleNode>.renderIntoSitemap(base: String? = null) {
val prefix by lazy(LazyThreadSafetyMode.NONE) { base?.let { "$it/" }.orEmpty() }
for (node in this) {
- if (Configuration.CurrentConfiguration.isDevMode || !(node.name.endsWith(".wip") || node.name.endsWith(".old"))) {
+ if (node.isViewable) {
val path = "$prefix${node.name}"
val file = File(Configuration.CurrentConfiguration.articleDir).combineSafe(path)