diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-04-23 23:26:36 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-04-30 12:31:05 +0200 |
commit | 423e7ee17c2cb28d4a34b91231560eff0656ffc0 (patch) | |
tree | 7e02e74d40ce0807011d7663c30ae2489ae08e2d /plugins/base/src/main/kotlin/transformers | |
parent | 3cd12e14d7465c197d4a6fc76d073328a46db349 (diff) | |
download | dokka-423e7ee17c2cb28d4a34b91231560eff0656ffc0.tar.gz dokka-423e7ee17c2cb28d4a34b91231560eff0656ffc0.tar.bz2 dokka-423e7ee17c2cb28d4a34b91231560eff0656ffc0.zip |
Fixing GFM components display
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index 2eb63504..4e65bae9 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -3,7 +3,6 @@ package org.jetbrains.dokka.base.transformers.pages.comments import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.plugability.DokkaContext object DocTagToContentConverter : CommentsToContentConverter { override fun buildContent( @@ -19,6 +18,11 @@ object DocTagToContentConverter : CommentsToContentConverter { buildContent(it, dci, platforms, styles + newStyles, newExtras?.let { extra + it } ?: extra) } + fun buildTableRows(rows: List<DocTag>, newStyle: Style): List<ContentGroup> = + rows.flatMap { + buildContent(it, dci, platforms, styles + newStyle, extra) as List<ContentGroup> + } + fun buildHeader(level: Int) = listOf( ContentHeader( @@ -42,9 +46,11 @@ object DocTagToContentConverter : CommentsToContentConverter { ) ) - fun buildNewLine() = listOf(ContentBreakLine( - platforms - )) + fun buildNewLine() = listOf( + ContentBreakLine( + platforms + ) + ) return when (docTag) { is H1 -> buildHeader(1) @@ -125,6 +131,27 @@ object DocTagToContentConverter : CommentsToContentConverter { styles ) ) + is Strikethrough -> buildChildren(docTag, setOf(TextStyle.Strikethrough)) + is Table -> listOf( + ContentTable( + buildTableRows(docTag.children.filterIsInstance<Th>(), CommentTable), + buildTableRows(docTag.children.filterIsInstance<Tr>(), CommentTable), + dci, + platforms, + styles + CommentTable + ) + ) + is Th, + is Tr -> listOf( + ContentGroup( + docTag.children.map { + ContentGroup(buildChildren(it), dci, platforms, styles, extra) + }, + dci, + platforms, + styles + ) + ) else -> buildChildren(docTag) } } |