aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt4
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt10
2 files changed, 6 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 362447d1..3086b82d 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -734,8 +734,6 @@ open class HtmlRenderer(
super.render(root)
}
- private fun PageNode.root(path: String) = locationProvider.pathToRoot(this) + path
-
override fun buildPage(page: ContentPage, content: (FlowContent, ContentPage) -> Unit): String =
buildHtml(page, page.embeddedResources) {
div("main-content") {
@@ -755,7 +753,7 @@ open class HtmlRenderer(
meta(name = "viewport", content = "width=device-width, initial-scale=1", charset = "UTF-8")
title(page.name)
templateCommand(PathToRootSubstitutionCommand("###", default = pathToRoot)) {
- link(href = page.root("###images/logo-icon.svg"), rel = "icon", type = "image/svg")
+ link(href = "###images/logo-icon.svg", rel = "icon", type = "image/svg")
}
templateCommand(PathToRootSubstitutionCommand("###", default = pathToRoot)) {
script { unsafe { +"""var pathToRoot = "###";""" } }
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt b/plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt
index d77426da..c77a6e94 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt
@@ -12,7 +12,7 @@ fun FlowContent.buildTextBreakableAfterCapitalLetters(name: String, hasLastEleme
}
buildBreakableText(withOutSpaces.last())
} else {
- val content = name.replace(Regex("(?!^)([A-Z])"), " $1").split(" ")
+ val content = name.replace(Regex("(?<=[a-z])([A-Z])"), " $1").split(" ")
joinToHtml(content, hasLastElement) {
it
}
@@ -35,13 +35,13 @@ private fun FlowContent.joinToHtml(elements: List<String>, hasLastElement: Boole
elements.dropLast(1).forEach {
buildBreakableHtmlElement(onEach(it))
}
- elements.last().takeIf { it.isNotBlank() }?.let {
+ elements.takeIf { it.isNotEmpty() && it.last().isNotEmpty() }?.let {
if (hasLastElement) {
span {
- buildBreakableHtmlElement(it, last = true)
+ buildBreakableHtmlElement(it.last(), last = true)
}
} else {
- buildBreakableHtmlElement(it, last = false)
+ buildBreakableHtmlElement(it.last(), last = false)
}
}
}
@@ -59,4 +59,4 @@ private fun FlowContent.buildBreakableHtmlElement(element: String, last: Boolean
fun FlowContent.buildBreakableText(name: String) =
if (name.contains(".")) buildBreakableDotSeparatedHtml(name)
- else buildTextBreakableAfterCapitalLetters(name) \ No newline at end of file
+ else buildTextBreakableAfterCapitalLetters(name, hasLastElement = true) \ No newline at end of file