aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2019-12-16 15:25:33 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-01-08 10:45:08 +0100
commit254e2a2dfae4f8d5eea26cdc4728b4fdb27cfee0 (patch)
tree15c3b5c22e4ad266c177cff8b499057e16ebade2 /core/src/main/kotlin
parentc4c992a2050f96871ea44cddbf39367f568bf544 (diff)
downloaddokka-254e2a2dfae4f8d5eea26cdc4728b4fdb27cfee0.tar.gz
dokka-254e2a2dfae4f8d5eea26cdc4728b4fdb27cfee0.tar.bz2
dokka-254e2a2dfae4f8d5eea26cdc4728b4fdb27cfee0.zip
change in list building logic
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index e9f2801e..961e942c 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -21,13 +21,16 @@ open class HtmlRenderer(
protected open fun buildListItems(items: List<ContentNode>, pageContext: PageNode) =
items.joinToString("") {
- if (it is ContentText) "<li>\n${it.build(pageContext)}\n</li>\n" else buildList(
- it as ContentList,
+ if (it is ContentList) buildList(
+ it,
pageContext
- )
+ ) else "<li>\n${it.build(pageContext)}\n</li>\n"
}
- override fun buildResource(node: ContentEmbeddedResource, pageContext: PageNode): String { // TODO: extension point there
+ override fun buildResource(
+ node: ContentEmbeddedResource,
+ pageContext: PageNode
+ ): String { // TODO: extension point there
val imageExtensions = setOf("png", "jpg", "jpeg", "gif", "bmp", "tif", "webp", "svg")
return if (File(node.address).extension.toLowerCase() in imageExtensions) {
val imgAttrs = node.extras.filterIsInstance<HTMLSimpleAttr>().joinAttr()
@@ -56,7 +59,8 @@ open class HtmlRenderer(
|</table>""".trimMargin()
}
- protected open fun ContentGroup.buildTableRow(pageContext: PageNode) = children.joinToString("</td>\n<td>\n") { it.build(pageContext) }
+ protected open fun ContentGroup.buildTableRow(pageContext: PageNode) =
+ children.joinToString("</td>\n<td>\n") { it.build(pageContext) }
override fun buildHeader(level: Int, text: String): String = "<h$level>$text</h$level>\n"
@@ -64,7 +68,8 @@ open class HtmlRenderer(
override fun buildLink(text: String, address: String): String = "<a href=\"$address\">$text</a>"
- override fun buildCode(code: List<ContentNode>, language: String, pageContext: PageNode): String = buildNewLine() + "<code>${code.joinToString("") { (it as ContentText).text + buildNewLine() }}</code>"
+ override fun buildCode(code: List<ContentNode>, language: String, pageContext: PageNode): String =
+ buildNewLine() + "<code>${code.joinToString("") { (it as ContentText).text + buildNewLine() }}</code>"
override fun buildText(textNode: ContentText): String = super.buildText(textNode).htmlEscape()