diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-10-27 17:12:31 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-10-29 11:57:20 +0100 |
commit | 3faa3f2d1c7ca33ad8d98bc6c562e4fe6977225f (patch) | |
tree | ab52ce7c62c485f892e12c05e0c619c44f410cf6 /src/Formats | |
parent | 44498ab2912d1156ad9d6549353251c9220af888 (diff) | |
download | dokka-3faa3f2d1c7ca33ad8d98bc6c562e4fe6977225f.tar.gz dokka-3faa3f2d1c7ca33ad8d98bc6c562e4fe6977225f.tar.bz2 dokka-3faa3f2d1c7ca33ad8d98bc6c562e4fe6977225f.zip |
summarize signatures for overloaded stdlib functions
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) }) |