diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2019-11-19 12:15:17 +0100 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2019-11-25 16:24:16 +0100 |
commit | d3bd543f569656e66112e584ad86af95ae7ea000 (patch) | |
tree | eb51dcbab246e5c641d28dbf08c7567241b64f42 /core/src | |
parent | def5b63ec4afa69d22f66bf1af76175fc1cdec3f (diff) | |
download | dokka-d3bd543f569656e66112e584ad86af95ae7ea000.tar.gz dokka-d3bd543f569656e66112e584ad86af95ae7ea000.tar.bz2 dokka-d3bd543f569656e66112e584ad86af95ae7ea000.zip |
HTML renderer refactor
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/renderers/HtmlRenderer.kt | 8 | ||||
-rw-r--r-- | core/src/main/kotlin/transformers/DefaultDocumentationToPageTransformer.kt | 7 |
2 files changed, 8 insertions, 7 deletions
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 |</tr> |</thead>""".trimMargin() - return """<table>``` + return """<table> |$tableHeader |<tbody> |<tr> - |<td>${node.children.joinToString("<td>\n</tr>\n<tr>\n<td>") { it.build(pageContext) }}</td> + |<td>${node.children.joinToString("</td>\n</tr>\n<tr>\n<td>\n") { it.buildTableRow(pageContext) }}</td> |</tr> |</tbody> |</table>""".trimMargin() } + 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" override fun buildNewLine(): String = "<br/>" - override fun buildLink(text: String, address: String): String = "<a href=\"$address\">${text.htmlEscape()}</a>" + 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>" 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 ) |