From d3bd543f569656e66112e584ad86af95ae7ea000 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 19 Nov 2019 12:15:17 +0100 Subject: HTML renderer refactor --- core/src/main/kotlin/renderers/HtmlRenderer.kt | 8 +++++--- .../kotlin/transformers/DefaultDocumentationToPageTransformer.kt | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt index adc3dd5a..f750140a 100644 --- a/core/src/main/kotlin/renderers/HtmlRenderer.kt +++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt @@ -35,21 +35,23 @@ open class HtmlRenderer(fileWriter: FileWriter, locationProvider: LocationProvid | |""".trimMargin() - return """``` + return """
|$tableHeader | | - |\n\n + |\n\n\n | | |
${node.children.joinToString("\n
") { it.build(pageContext) }}${node.children.joinToString("
\n") { it.buildTableRow(pageContext) }}
""".trimMargin() } + protected open fun ContentGroup.buildTableRow(pageContext: PageNode) = children.joinToString("\n\n") { it.build(pageContext) } + override fun buildHeader(level: Int, text: String): String = "$text\n" override fun buildNewLine(): String = "
" - override fun buildLink(text: String, address: String): String = "${text.htmlEscape()}" + override fun buildLink(text: String, address: String): String = "$text" override fun buildCode(code: List, language: String, pageContext: PageNode): String = "$code" diff --git a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt index 3f3cb7a2..6cfcec56 100644 --- a/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt +++ b/core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt @@ -131,10 +131,9 @@ class DefaultDocumentationToPageTransformer( ) { header(level) { text(name) } - contents += ContentGroup( - elements.map { - group(it, kind) { operation(it) } - }, + contents += ContentTable( + emptyList(), + elements.map { group(it, kind) { operation(it) } }, DCI(node.dri, kind), platformData, styles, extras ) -- cgit