From 287c8207f6c7534ac9c5dfbc6e2ce10fae9a696b Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 23 Feb 2017 12:01:55 +0100 Subject: Show platforms of a node in summary table --- core/src/main/kotlin/Formats/StructuredFormatService.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 02ec01b0..71f9d577 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -457,11 +457,12 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, val membersMap = children.groupBy { link(node, it) } appendTable("Name", "Summary") { - appendTableBody() { + appendTableBody { for ((memberLocation, members) in membersMap) { - appendTableRow() { + appendTableRow { appendTableCell { appendLink(memberLocation) + appendPlatforms(members) } appendTableCell { val breakdownBySummary = members.groupBy { it.summary } @@ -495,6 +496,16 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, renderedSignatures.last().appendSignature() } } + + private fun appendPlatforms(items: List) { + val platforms = items.foldRight(items.first().platforms.toSet()) { + node, platforms -> platforms.intersect(node.platforms) + } + if (platforms.isNotEmpty()) { + appendLine() + to.append("(${platforms.joinToString()})") + } + } } inner class AllTypesNodeBuilder(val node: DocumentationNode) -- cgit