aboutsummaryrefslogtreecommitdiff
path: root/src/Formats/StructuredFormatService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formats/StructuredFormatService.kt')
-rw-r--r--src/Formats/StructuredFormatService.kt50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 40feaf21..f2fb9b41 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -103,30 +103,36 @@ public abstract class StructuredFormatService(val locationService: LocationServi
}
for (node in nodes) {
- if (node.members.any()) {
- appendHeader(to, "Members", 3)
+ appendSection("Members", node.members, node, to)
+ appendSection("Extensions", node.extensions, node, to)
+ appendSection("Links", node.links, node, to)
+ }
+ }
- val children = node.members.sortBy { it.name }
- val membersMap = children.groupBy { link(node, it) }
+ private fun StructuredFormatService.appendSection(caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) {
+ if (nodes.any()) {
+ appendHeader(to, caption, 3)
- appendTable(to) {
- appendTableBody(to) {
- for ((location, members) in membersMap) {
- appendTableRow(to) {
- appendTableCell(to) {
- appendText(to, formatLink(location))
- }
- appendTableCell(to) {
- val breakdownBySummary = members.groupBy { it.doc.summary }
- for ((summary, items) in breakdownBySummary) {
- val signatures = items.map { formatCode("${languageService.render(it)}") }
- for (signature in signatures) {
- appendText(to, signature)
- }
-
- if (!summary.isEmpty()) {
- appendText(to, formatText(summary))
- }
+ val children = nodes.sortBy { it.name }
+ val membersMap = children.groupBy { link(node, it) }
+
+ appendTable(to) {
+ appendTableBody(to) {
+ for ((location, members) in membersMap) {
+ appendTableRow(to) {
+ appendTableCell(to) {
+ appendText(to, formatLink(location))
+ }
+ appendTableCell(to) {
+ val breakdownBySummary = members.groupBy { it.doc.summary }
+ for ((summary, items) in breakdownBySummary) {
+ val signatures = items.map { formatCode("${languageService.render(it)}") }
+ for (signature in signatures) {
+ appendText(to, signature)
+ }
+
+ if (!summary.isEmpty()) {
+ appendText(to, formatText(summary))
}
}
}