aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-08-25 09:41:01 +0200
committerMarcin Aman <marcin.aman@gmail.com>2021-08-25 09:41:01 +0200
commit3d416fec95e741289b02bf4a4b2e0fdf06de0aea (patch)
treee65f0a0a84c3a380d8d20f7ee5bd7f1ec05100bb /plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt
parent9044761979d08b3b116c9f8416dfb42ae216898c (diff)
downloaddokka-3d416fec95e741289b02bf4a4b2e0fdf06de0aea.tar.gz
dokka-3d416fec95e741289b02bf4a4b2e0fdf06de0aea.tar.bz2
dokka-3d416fec95e741289b02bf4a4b2e0fdf06de0aea.zip
Fix breakable labels and icon on single module project
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlFormatingUtils.kt10
1 files changed, 5 insertions, 5 deletions
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