diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-09-14 13:49:54 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-07 02:36:57 +0200 |
commit | ec637955575995011351b106d3a67194d21c4b15 (patch) | |
tree | 5762d6ca0c49cc48dec01240380bc6fd436e81b0 /plugins/base/src/main/kotlin/transformers/pages | |
parent | 7c4301a48af55e156538666b6e645d8d13caae9a (diff) | |
download | dokka-ec637955575995011351b106d3a67194d21c4b15.tar.gz dokka-ec637955575995011351b106d3a67194d21c4b15.tar.bz2 dokka-ec637955575995011351b106d3a67194d21c4b15.zip |
Introduce top-level DocTag
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/pages')
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt | 15 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt | 18 |
2 files changed, 31 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt index 7914e88f..acff5ada 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt @@ -1,7 +1,9 @@ package org.jetbrains.dokka.base.transformers.pages.annotations +import org.intellij.markdown.MarkdownElementTypes import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* +import org.jetbrains.dokka.model.doc.CustomDocTag import org.jetbrains.dokka.model.doc.CustomTagWrapper import org.jetbrains.dokka.model.doc.Text import org.jetbrains.dokka.model.properties.WithExtraProperties @@ -73,10 +75,19 @@ class SinceKotlinTransformer(val context: DokkaContext) : DocumentableTransforme acc.mapValues { if (it.key == sourceSet) it.value.copy( it.value.children + listOf( - CustomTagWrapper(Text(version.dropWhile { it == '"' }.dropLastWhile { it == '"' }), "Since Kotlin") + CustomTagWrapper( + CustomDocTag( + listOf( + Text(version.dropWhile { it == '"' }.dropLastWhile { it == '"' } + ) + ), + name = MarkdownElementTypes.MARKDOWN_FILE.name + ), + "Since Kotlin" + ) ) ) else it.value } } ?: acc } -}
\ No newline at end of file +} 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 51ab0858..0fea6b4f 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.base.transformers.pages.comments +import org.intellij.markdown.MarkdownElementTypes import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer @@ -175,7 +176,24 @@ object DocTagToContentConverter : CommentsToContentConverter { styles ) ) + + is CustomDocTag -> if (docTag.isNonemptyFile()) { + listOf( + ContentGroup( + buildChildren(docTag), + dci, + sourceSets.toDisplaySourceSets(), + styles, + extra = extra + ) + ) + } else { + buildChildren(docTag) + } + else -> buildChildren(docTag) } } + + private fun CustomDocTag.isNonemptyFile() = name == MarkdownElementTypes.MARKDOWN_FILE.name && children.size > 1 } |