From a52e1d543d22fdacf87ec00988b753d2d1107c1d Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Fri, 3 Oct 2014 15:57:16 +0400 Subject: Work on cross-references. --- src/Formats/StructuredFormatService.kt | 50 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'src/Formats/StructuredFormatService.kt') 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, 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)) } } } -- cgit