aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/documentables
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-04-10 16:59:25 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-13 10:03:48 +0200
commit6166ddfeb6ee977a302d4cacc80dac23cc7e2baf (patch)
tree1fb93e53c8fbd5f76cf2f1438fa0ff4cdfe3494e /plugins/base/src/main/kotlin/translators/documentables
parent79d1827b5d249c0a597c6c2f9cb91ff8f5689d94 (diff)
downloaddokka-6166ddfeb6ee977a302d4cacc80dac23cc7e2baf.tar.gz
dokka-6166ddfeb6ee977a302d4cacc80dac23cc7e2baf.tar.bz2
dokka-6166ddfeb6ee977a302d4cacc80dac23cc7e2baf.zip
Working tests for includes, sources and samples. Minor bugfixes
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/documentables')
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 424e6aa4..dd28b533 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -284,6 +284,23 @@ open class DefaultPageCreator(
}
}
+ fun DocumentableContentBuilder.contentForSamples() {
+ val samples = tags.withTypeNamed<Sample>()
+ if (samples.isNotEmpty()) {
+ platforms.forEach { platformData ->
+ val content = samples.filter { it.value.isEmpty() || platformData in it.value }
+ if (content.isNotEmpty()) {
+ group(platformData = setOf(platformData)) {
+ header(4, kind = ContentKind.Comment) { text("Samples") }
+ content.forEach {
+ comment(Text(it.key))
+ }
+ }
+ }
+ }
+ }
+ }
+
fun DocumentableContentBuilder.contentForUnnamedTags() {
val unnamedTags: List<PlatformDependent<TagWrapper>> =
tags.filterNot { (k, _) -> k.isSubclassOf(NamedTagWrapper::class) || k in specialTags }
@@ -305,6 +322,7 @@ open class DefaultPageCreator(
header(3) { text("Description") }
platformDependentHint(platformData = platforms.toSet()) {
contentForDescription()
+ contentForSamples()
contentForParams()
contentForUnnamedTags()
contentForSeeAlso()