aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/renderers
diff options
context:
space:
mode:
authorBarkingBad <32793002+BarkingBad@users.noreply.github.com>2019-12-13 14:01:25 +0100
committerKamil Doległo <kamilok1965@interia.pl>2019-12-13 14:02:13 +0100
commitdd017a44ed7baae83f4f09a92d9691231f424eaa (patch)
treead9a7b6634ff4e4ead43122b13b0fb6dcdfcea85 /core/src/main/kotlin/renderers
parent0900b0f1c3a593301a6229ce93a23b8228771d24 (diff)
downloaddokka-dd017a44ed7baae83f4f09a92d9691231f424eaa.tar.gz
dokka-dd017a44ed7baae83f4f09a92d9691231f424eaa.tar.bz2
dokka-dd017a44ed7baae83f4f09a92d9691231f424eaa.zip
Add abstract structure for MD/HTML comments and MD parser
Diffstat (limited to 'core/src/main/kotlin/renderers')
-rw-r--r--core/src/main/kotlin/renderers/HtmlRenderer.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt
index c04a18b4..e9f2801e 100644
--- a/core/src/main/kotlin/renderers/HtmlRenderer.kt
+++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt
@@ -20,7 +20,12 @@ open class HtmlRenderer(
}
protected open fun buildListItems(items: List<ContentNode>, pageContext: PageNode) =
- "<li>\n${items.joinToString("\n</li>\n<li>\n") { it.build(pageContext) }}\n</li>"
+ items.joinToString("") {
+ if (it is ContentText) "<li>\n${it.build(pageContext)}\n</li>\n" else buildList(
+ it as ContentList,
+ pageContext
+ )
+ }
override fun buildResource(node: ContentEmbeddedResource, pageContext: PageNode): String { // TODO: extension point there
val imageExtensions = setOf("png", "jpg", "jpeg", "gif", "bmp", "tif", "webp", "svg")
@@ -59,7 +64,7 @@ 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 = "<code>$code</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()