From 2b921897aa90216d78e05165d5ce122814ead74c Mon Sep 17 00:00:00 2001 From: Filip ZybaƂa Date: Wed, 1 Apr 2020 17:20:44 +0200 Subject: Changed see also parsing, added see also section to pages --- .../translators/documentables/DefaultPageCreator.kt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'plugins/base') diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 177d5021..e8cdb2cf 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -245,6 +245,26 @@ open class DefaultPageCreator( } } + fun DocumentableContentBuilder.contentForSeeAlso() { + val seeAlsoTags = tags.withTypeNamed() + if(seeAlsoTags.isNotEmpty()) { + header(4, kind = ContentKind.Comment) { text("See also") } + table(kind = ContentKind.Comment) { + platforms.flatMap { platform -> + seeAlsoTags.mapNotNull { (_, see) -> + see.getOrExpect(platform)?.let { + buildGroup { + if (it.address != null) link(it.name, it.address!!) + else text(it.name) + comment(it.root) + } + } + } + } + } + } + } + fun DocumentableContentBuilder.contentForUnnamedTags() { val unnamedTags: List> = tags.filterNot { (k, _) -> k.isSubclassOf(NamedTagWrapper::class) || k in specialTags } @@ -268,6 +288,7 @@ open class DefaultPageCreator( contentForDescription() contentForParams() contentForUnnamedTags() + contentForSeeAlso() } } }.children -- cgit