diff options
Diffstat (limited to 'src/Formats')
-rw-r--r-- | src/Formats/HtmlFormatService.kt | 2 | ||||
-rw-r--r-- | src/Formats/KotlinWebsiteFormatService.kt | 1 | ||||
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 51 |
3 files changed, 34 insertions, 20 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt index 74b10255..8e38a32c 100644 --- a/src/Formats/HtmlFormatService.kt +++ b/src/Formats/HtmlFormatService.kt @@ -152,7 +152,7 @@ fun formatPageTitle(node: DocumentationNode): String { if (path.size == 1) { return path.first().name } - val qualifiedName = path.drop(1).map { it.name }.filter { it.length > 0 }.joinToString(".") + val qualifiedName = node.qualifiedName() if (qualifiedName.length == 0 && path.size == 2) { return path.first().name + " / root package" } diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt index 3a9fc6cd..97419c58 100644 --- a/src/Formats/KotlinWebsiteFormatService.kt +++ b/src/Formats/KotlinWebsiteFormatService.kt @@ -90,6 +90,7 @@ public class KotlinWebsiteFormatService(locationService: LocationService, private fun identifierClassName(kind: IdentifierKind) = when(kind) { IdentifierKind.ParameterName -> "parameterName" + IdentifierKind.SummarizedTypeName -> "summarizedTypeName" else -> "identifier" } } diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index a9b058d1..405a8b10 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -221,7 +221,7 @@ public abstract class StructuredFormatService(locationService: LocationService, } } - private fun StructuredFormatService.appendSection(location: Location, caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) { + private fun appendSection(location: Location, caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) { if (nodes.any()) { appendHeader(to, caption, 3) @@ -238,24 +238,7 @@ public abstract class StructuredFormatService(locationService: LocationService, appendTableCell(to) { val breakdownBySummary = members.groupBy { formatText(location, it.summary) } for ((summary, items) in breakdownBySummary) { - val signatureTexts = items.map { signature -> - val signatureText = languageService.render(signature, RenderMode.SUMMARY) - if (signatureText is ContentBlock && signatureText.isEmpty()) { - "" - } else { - val signatureAsCode = ContentCode() - signatureAsCode.append(signatureText) - formatText(location, signatureAsCode) - } - } - signatureTexts.subList(0, signatureTexts.size -1).forEach { - appendAsSignature(to) { - appendLine(to, it) - } - } - appendAsSignature(to) { - to.append(signatureTexts.last()) - } + appendSummarySignatures(items, location, to) if (!summary.isEmpty()) { to.append(summary) } @@ -268,6 +251,36 @@ public abstract class StructuredFormatService(locationService: LocationService, } } + private fun appendSummarySignatures(items: List<DocumentationNode>, location: Location, to: StringBuilder) { + val summarySignature = languageService.summarizeSignatures(items) + if (summarySignature != null) { + appendAsSignature(to) { + val signatureAsCode = ContentCode() + signatureAsCode.append(summarySignature) + to.append(formatText(location, signatureAsCode)) + } + return + } + val signatureTexts = items.map { signature -> + val signatureText = languageService.render(signature, RenderMode.SUMMARY) + if (signatureText is ContentBlock && signatureText.isEmpty()) { + "" + } else { + val signatureAsCode = ContentCode() + signatureAsCode.append(signatureText) + formatText(location, signatureAsCode) + } + } + signatureTexts.subList(0, signatureTexts.size - 1).forEach { + appendAsSignature(to) { + appendLine(to, it) + } + } + appendAsSignature(to) { + to.append(signatureTexts.last()) + } + } + override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) { val breakdownByLocation = nodes.groupBy { node -> formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) }) |