diff options
author | Zubakov <aleks.zubakov@gmail.com> | 2018-09-21 16:03:51 +0300 |
---|---|---|
committer | Simon Ogorodnik <simon.ogorodnik@gmail.com> | 2018-09-21 16:06:04 +0300 |
commit | 312b50005bae6cbdea6a203c37bee3006a90b641 (patch) | |
tree | 24562295bf12b615e56877de975d79373cec8a60 /core/src/main | |
parent | d80b38a15c1a43c687957403c77b35deba05bd9e (diff) | |
download | dokka-312b50005bae6cbdea6a203c37bee3006a90b641.tar.gz dokka-312b50005bae6cbdea6a203c37bee3006a90b641.tar.bz2 dokka-312b50005bae6cbdea6a203c37bee3006a90b641.zip |
Fix number of platforms bubbles
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/kotlin/Formats/StructuredFormatService.kt | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 53172563..927e0827 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -712,7 +712,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } appendTableCell { - appendSummarySignatures(members, platformsBasedOnMembers, omitSamePlatforms) + appendSummarySignatures(members, platformsBasedOnMembers, omitSamePlatforms, platforms) } } } @@ -732,7 +732,12 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, return emptySet() } - private fun appendSummarySignatures(items: List<DocumentationNode>, platformsBasedOnMembers: Boolean, omitSamePlatforms: Boolean) { + private fun appendSummarySignatures( + items: List<DocumentationNode>, + platformsBasedOnMembers: Boolean, + omitSamePlatforms: Boolean, + parentPlatforms: Set<String> + ) { val groupBySummary = items.groupBy { it.summary } for ((summary, node) in groupBySummary) { @@ -744,32 +749,50 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, val summarySignature = languageService.summarizeSignatures(nodesToAppend) if (summarySignature != null) { - appendSignatures(summarySignature, items, platformsBasedOnMembers, omitSamePlatforms) + appendSignatures(summarySignature, items, platformsBasedOnMembers, omitSamePlatforms, parentPlatforms) } else { val groupBySignature = nodesToAppend.groupBy { languageService.render(it, RenderMode.SUMMARY) } for ((sign, members) in groupBySignature) { - appendSignatures(sign, members, platformsBasedOnMembers, omitSamePlatforms) + appendSignatures(sign, members, platformsBasedOnMembers, omitSamePlatforms, parentPlatforms) } } val platforms = platformsOfItems(node) - appendAsBlockWithPlatforms(platforms) { + val platformsToAppend = if (platforms == parentPlatforms) { + emptySet() + } else { + platforms + } + appendAsBlockWithPlatforms(platformsToAppend) { appendContent(summary) appendSoftLineBreak() } } } - private fun appendSignatures(signature: ContentNode, items: List<DocumentationNode>, platformsBasedOnMembers: Boolean, omitSamePlatforms: Boolean) { + private fun appendSignatures( + signature: ContentNode, + items: List<DocumentationNode>, + platformsBasedOnMembers: Boolean, + omitSamePlatforms: Boolean, + parentPlatforms: Set<String> + ) { val elementPlatforms = platformsOfItems(items, omitSamePlatforms) val platforms = if (platformsBasedOnMembers) items.flatMapTo(mutableSetOf()) { platformsOfItems(it.members) } + elementPlatforms else elementPlatforms - appendAsBlockWithPlatforms(platforms) { + + val platformsToAppend = if (platforms == parentPlatforms) { + emptySet() + } else { + platforms + } + + appendAsBlockWithPlatforms(platformsToAppend) { appendPlatforms(platforms) appendAsSignature(signature) { signature.appendSignature() |