aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorFilip Zybała <fzybala@virtuslab.com>2020-05-27 13:03:32 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-27 13:12:51 +0200
commitdd5d4ba7d80b0880489cf74bb11549ff836fc41f (patch)
tree60886094f7e3128858cbf66e9ee41261830bfb37 /plugins/base/src/main/kotlin
parent4d5a0ebc3045b51385056e57e9a0ce4108729072 (diff)
downloaddokka-dd5d4ba7d80b0880489cf74bb11549ff836fc41f.tar.gz
dokka-dd5d4ba7d80b0880489cf74bb11549ff836fc41f.tar.bz2
dokka-dd5d4ba7d80b0880489cf74bb11549ff836fc41f.zip
Fixed table rendering for markdown.
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt43
1 files changed, 39 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 792eb1dc..52f7024a 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -302,10 +302,45 @@ open class HtmlRenderer(
pageContext: ContentPage,
sourceSetRestriction: Set<SourceSetData>?
) {
- div(classes = "table") {
- node.extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue }
- node.children.forEach {
- buildRow(it, pageContext, sourceSetRestriction)
+ when(node.dci.kind){
+ ContentKind.Comment -> buildDefaultTable(node, pageContext, sourceSetRestriction)
+ else -> div(classes = "table") {
+ node.extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue }
+ node.children.forEach {
+ buildRow(it, pageContext, sourceSetRestriction)
+ }
+ }
+ }
+
+ }
+
+ fun FlowContent.buildDefaultTable(
+ node: ContentTable,
+ pageContext: ContentPage,
+ sourceSetRestriction: Set<SourceSetData>?
+ ) {
+ table {
+ thead {
+ node.header.forEach {
+ tr {
+ it.children.forEach {
+ th {
+ it.build(this@table, pageContext, sourceSetRestriction)
+ }
+ }
+ }
+ }
+ }
+ tbody {
+ node.children.forEach {
+ tr {
+ it.children.forEach {
+ td {
+ it.build(this, pageContext, sourceSetRestriction)
+ }
+ }
+ }
+ }
}
}
}