diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2020-10-30 19:01:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 19:01:09 +0100 |
commit | 1aba0ec4973d7915caa93f1e9b3146ad82111903 (patch) | |
tree | b9424de4bc22f8453ecb32aaa8f7f020bcd49e9f /plugins/base/src/main/kotlin/transformers/pages/comments | |
parent | da498f50eabfad8969eb7795a535e97f7e25ca58 (diff) | |
download | dokka-1aba0ec4973d7915caa93f1e9b3146ad82111903.tar.gz dokka-1aba0ec4973d7915caa93f1e9b3146ad82111903.tar.bz2 dokka-1aba0ec4973d7915caa93f1e9b3146ad82111903.zip |
Fix parsing first word in deprecated (#1595)
Fix parsing first word in `Deprecated` annotations, fix `Throws` and `See` tags
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/pages/comments')
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt | 55 |
1 files changed, 46 insertions, 9 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 d05979e3..a3a9ad6a 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -6,6 +6,7 @@ import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* +import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull open class DocTagToContentConverter : CommentsToContentConverter { override fun buildContent( @@ -148,15 +149,42 @@ open class DocTagToContentConverter : CommentsToContentConverter { ) ) is Strikethrough -> buildChildren(docTag, setOf(TextStyle.Strikethrough)) - is Table -> listOf( - ContentTable( - buildTableRows(docTag.children.filterIsInstance<Th>(), CommentTable), - buildTableRows(docTag.children.filterIsInstance<Tr>(), CommentTable), - dci, - sourceSets.toDisplaySourceSets(), - styles + CommentTable - ) - ) + is Table -> { + //https://html.spec.whatwg.org/multipage/tables.html#the-caption-element + if (docTag.children.any { it is TBody }) { + val head = docTag.children.filterIsInstance<THead>().flatMap { it.children } + val body = docTag.children.filterIsInstance<TBody>().flatMap { it.children } + listOf( + ContentTable( + header = buildTableRows(head.filterIsInstance<Th>(), CommentTable), + caption = docTag.children.firstIsInstanceOrNull<Caption>()?.let { + ContentGroup( + buildContent(it, dci, sourceSets), + dci, + sourceSets.toDisplaySourceSets(), + styles, + extra + ) + }, + buildTableRows(body.filterIsInstance<Tr>(), CommentTable), + dci, + sourceSets.toDisplaySourceSets(), + styles + CommentTable + ) + ) + } else { + listOf( + ContentTable( + header = buildTableRows(docTag.children.filterIsInstance<Th>(), CommentTable), + caption = null, + buildTableRows(docTag.children.filterIsInstance<Tr>(), CommentTable), + dci, + sourceSets.toDisplaySourceSets(), + styles + CommentTable + ) + ) + } + } is Th, is Tr -> listOf( ContentGroup( @@ -190,6 +218,15 @@ open class DocTagToContentConverter : CommentsToContentConverter { } else { buildChildren(docTag) } + is Caption -> listOf( + ContentGroup( + buildChildren(docTag), + dci, + sourceSets.toDisplaySourceSets(), + styles + ContentStyle.Caption, + extra = extra + ) + ) else -> buildChildren(docTag) } |