From 8422874793845c1bb5234b91f858d74e80c956f7 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 27 Sep 2018 18:22:49 +0300 Subject: Render signatures in platform dependent block --- .../main/kotlin/Formats/StructuredFormatService.kt | 40 ++++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 04710694..162976a6 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -362,19 +362,21 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, fun renderSimpleNode(item: DocumentationNode, isSingleNode: Boolean) { - // TODO: use summarizesignatures - val rendered = languageService.render(item) - item.detailOrNull(NodeKind.Signature)?.let { - if (item.kind !in NodeKind.classLike || !isSingleNode) - appendAnchor(it.name) - } - appendAsSignature(rendered) { - appendCode { appendContent(rendered) } - item.appendSourceLink() - } - item.appendOverrides() - item.appendDeprecation() - item.appendPlatforms() + appendAsPlatformDependentBlock(effectivePlatformAndVersion(listOf(item))) { platforms -> + // TODO: use summarizesignatures + val rendered = languageService.render(item) + item.detailOrNull(NodeKind.Signature)?.let { + if (item.kind !in NodeKind.classLike || !isSingleNode) + appendAnchor(it.name) + } + appendAsSignature(rendered) { + appendCode { appendContent(rendered) } + item.appendSourceLink() + } + item.appendOverrides() + item.appendDeprecation() + appendPlatforms(platforms) + } } fun renderGroupNode(item: DocumentationNode, isSingleNode: Boolean) { @@ -725,6 +727,12 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, nodes } + val platformsToAppend = effectivePlatformAndVersion(nodes) + appendAsPlatformDependentBlock(platformsToAppend) { + appendContent(summary) + appendSoftLineBreak() + } + val summarySignature = languageService.summarizeSignatures(nodesToAppend) if (summarySignature != null) { appendSignatures(summarySignature, nodes, platformsBasedOnMembers, omitSamePlatforms, parentPlatforms) @@ -736,12 +744,6 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendSignatures(sign, members, platformsBasedOnMembers, omitSamePlatforms, parentPlatforms) } } - - val platformsToAppend = effectivePlatformAndVersion(nodes) - appendAsPlatformDependentBlock(platformsToAppend) { - appendContent(summary) - appendSoftLineBreak() - } } } -- cgit