Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 1 | package org.jetbrains.dokka |
| 2 | |
| 3 | import java.util.LinkedHashMap |
Dmitry Jemerov | 0c584d0 | 2015-01-12 17:23:07 +0100 | [diff] [blame] | 4 | import org.jetbrains.dokka.LanguageService.RenderMode |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 5 | |
Dmitry Jemerov | d9bfa02 | 2015-02-19 18:59:00 +0100 | [diff] [blame] | 6 | public data class FormatLink(val text: String, val href: String) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 7 | |
Dmitry Jemerov | ea1f4cc | 2015-02-19 19:51:01 +0100 | [diff] [blame^] | 8 | public abstract class StructuredFormatService(locationService: LocationService, |
| 9 | val languageService: LanguageService, |
| 10 | override val extension: String) : FormatService { |
| 11 | val locationService: LocationService = locationService.withExtension(extension) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 12 | |
| 13 | abstract public fun appendBlockCode(to: StringBuilder, line: String) |
| 14 | abstract public fun appendBlockCode(to: StringBuilder, lines: Iterable<String>) |
| 15 | abstract public fun appendHeader(to: StringBuilder, text: String, level: Int = 1) |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 16 | abstract public fun appendParagraph(to: StringBuilder, text: String) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 17 | abstract public fun appendLine(to: StringBuilder, text: String) |
| 18 | public abstract fun appendLine(to: StringBuilder) |
Ilya Ryzhenkov | 499d082 | 2014-07-15 16:18:53 +0400 | [diff] [blame] | 19 | |
Ilya Ryzhenkov | aa59acb | 2014-07-15 20:05:55 +0400 | [diff] [blame] | 20 | public abstract fun appendTable(to: StringBuilder, body: () -> Unit) |
| 21 | public abstract fun appendTableHeader(to: StringBuilder, body: () -> Unit) |
| 22 | public abstract fun appendTableBody(to: StringBuilder, body: () -> Unit) |
| 23 | public abstract fun appendTableRow(to: StringBuilder, body: () -> Unit) |
| 24 | public abstract fun appendTableCell(to: StringBuilder, body: () -> Unit) |
Ilya Ryzhenkov | 499d082 | 2014-07-15 16:18:53 +0400 | [diff] [blame] | 25 | |
Ilya Ryzhenkov | aa59acb | 2014-07-15 20:05:55 +0400 | [diff] [blame] | 26 | public abstract fun formatText(text: String): String |
Ilya Ryzhenkov | 7c6da4b | 2014-10-03 19:09:31 +0400 | [diff] [blame] | 27 | public abstract fun formatSymbol(text: String): String |
| 28 | public abstract fun formatKeyword(text: String): String |
| 29 | public abstract fun formatIdentifier(text: String): String |
Ilya Ryzhenkov | 71cd87e | 2014-10-03 22:51:44 +0400 | [diff] [blame] | 30 | public abstract fun formatLink(text: String, href: String): String |
Dmitry Jemerov | d9bfa02 | 2015-02-19 18:59:00 +0100 | [diff] [blame] | 31 | public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href) |
Ilya Ryzhenkov | 9f0ff55 | 2014-10-13 13:38:40 +0400 | [diff] [blame] | 32 | public abstract fun formatStrong(text: String): String |
Dmitry Jemerov | e17eaa5 | 2015-01-09 20:59:58 +0100 | [diff] [blame] | 33 | public abstract fun formatStrikethrough(text: String): String |
Ilya Ryzhenkov | 9f0ff55 | 2014-10-13 13:38:40 +0400 | [diff] [blame] | 34 | public abstract fun formatEmphasis(text: String): String |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 35 | public abstract fun formatCode(code: String): String |
Ilya Ryzhenkov | 1839949 | 2014-12-22 09:50:17 +0200 | [diff] [blame] | 36 | public abstract fun formatList(text: String): String |
| 37 | public abstract fun formatListItem(text: String): String |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 38 | public abstract fun formatBreadcrumbs(items: Iterable<FormatLink>): String |
| 39 | |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 40 | open fun formatText(location: Location, nodes: Iterable<ContentNode>): String { |
| 41 | return nodes.map { formatText(location, it) }.join("") |
Ilya Ryzhenkov | 778e2b3 | 2014-09-29 20:54:59 +0400 | [diff] [blame] | 42 | } |
| 43 | |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 44 | open fun formatText(location: Location, content: ContentNode): String { |
Ilya Ryzhenkov | 455d74a | 2014-09-19 22:25:27 +0300 | [diff] [blame] | 45 | return StringBuilder { |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 46 | when (content) { |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 47 | is ContentText -> append(formatText(content.text)) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 48 | is ContentSymbol -> append(formatSymbol(content.text)) |
| 49 | is ContentKeyword -> append(formatKeyword(content.text)) |
| 50 | is ContentIdentifier -> append(formatIdentifier(content.text)) |
Ilya Ryzhenkov | 9f0ff55 | 2014-10-13 13:38:40 +0400 | [diff] [blame] | 51 | is ContentStrong -> append(formatStrong(formatText(location, content.children))) |
Dmitry Jemerov | e17eaa5 | 2015-01-09 20:59:58 +0100 | [diff] [blame] | 52 | is ContentStrikethrough -> append(formatStrikethrough(formatText(location, content.children))) |
Ilya Ryzhenkov | 9f0ff55 | 2014-10-13 13:38:40 +0400 | [diff] [blame] | 53 | is ContentCode -> append(formatCode(formatText(location, content.children))) |
| 54 | is ContentEmphasis -> append(formatEmphasis(formatText(location, content.children))) |
Ilya Ryzhenkov | 1839949 | 2014-12-22 09:50:17 +0200 | [diff] [blame] | 55 | is ContentList -> append(formatList(formatText(location, content.children))) |
| 56 | is ContentListItem -> append(formatListItem(formatText(location, content.children))) |
| 57 | |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 58 | is ContentNodeLink -> { |
Dmitry Jemerov | ea1f4cc | 2015-02-19 19:51:01 +0100 | [diff] [blame^] | 59 | val linkTo = location.relativePathTo(locationService.location(content.node)) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 60 | val linkText = formatText(location, content.children) |
| 61 | append(formatLink(linkText, linkTo)) |
| 62 | } |
Ilya Ryzhenkov | 71cd87e | 2014-10-03 22:51:44 +0400 | [diff] [blame] | 63 | is ContentExternalLink -> { |
| 64 | val linkText = formatText(location, content.children) |
| 65 | append(formatLink(linkText, content.href)) |
| 66 | } |
Ilya Ryzhenkov | ad14ea9 | 2014-10-13 18:22:02 +0400 | [diff] [blame] | 67 | is ContentParagraph -> { |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 68 | appendParagraph(this, formatText(location, content.children)) |
Ilya Ryzhenkov | ad14ea9 | 2014-10-13 18:22:02 +0400 | [diff] [blame] | 69 | } |
Ilya Ryzhenkov | 1cb3af9 | 2014-10-13 20:14:45 +0400 | [diff] [blame] | 70 | is ContentBlockCode -> { |
| 71 | appendBlockCode(this, formatText(location, content.children)) |
| 72 | } |
Dmitry Jemerov | 0d0fc1f | 2015-02-10 18:32:12 +0100 | [diff] [blame] | 73 | is ContentBlock -> append(formatText(location, content.children)) |
Ilya Ryzhenkov | 455d74a | 2014-09-19 22:25:27 +0300 | [diff] [blame] | 74 | } |
| 75 | }.toString() |
| 76 | } |
| 77 | |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 78 | open public fun link(from: DocumentationNode, to: DocumentationNode): FormatLink = link(from, to, extension) |
| 79 | |
| 80 | open public fun link(from: DocumentationNode, to: DocumentationNode, extension: String): FormatLink { |
Dmitry Jemerov | ea1f4cc | 2015-02-19 19:51:01 +0100 | [diff] [blame^] | 81 | return FormatLink(to.name, locationService.relativePathToLocation(from, to)) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 82 | } |
| 83 | |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 84 | fun appendDocumentation(location: Location, to: StringBuilder, overloads: Iterable<DocumentationNode>) { |
| 85 | val breakdownBySummary = overloads.groupByTo(LinkedHashMap()) { node -> node.content } |
Dmitry Jemerov | bfd9ffd | 2015-01-30 17:59:15 +0100 | [diff] [blame] | 86 | |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 87 | for ((summary, items) in breakdownBySummary) { |
| 88 | items.forEach { |
Dmitry Jemerov | ebbf265 | 2015-02-10 19:35:27 +0100 | [diff] [blame] | 89 | to.append(formatCode(formatText(location, languageService.render(it)))) |
| 90 | it.appendSourceLink(to) |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 91 | it.appendOverrides(to) |
| 92 | it.appendDeprecation(to) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 93 | } |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 94 | // All items have exactly the same documentation, so we can use any item to render it |
| 95 | val item = items.first() |
Dmitry Jemerov | ebbf265 | 2015-02-10 19:35:27 +0100 | [diff] [blame] | 96 | to.append(formatText(location, item.content.summary)) |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 97 | appendDescription(location, to, item) |
Dmitry Jemerov | ebbf265 | 2015-02-10 19:35:27 +0100 | [diff] [blame] | 98 | appendLine(to) |
| 99 | appendLine(to) |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 100 | } |
| 101 | } |
| 102 | |
| 103 | fun appendDescription(location: Location, to: StringBuilder, node: DocumentationNode) { |
| 104 | if (node.content.description != ContentEmpty) { |
| 105 | appendHeader(to, "Description", 3) |
| 106 | appendLine(to, formatText(location, node.content.description)) |
| 107 | appendLine(to) |
| 108 | } |
| 109 | node.content.getSectionsWithSubjects().forEach { |
| 110 | appendSectionWithSubject(it.getKey(), location, it.getValue(), to) |
| 111 | } |
| 112 | |
| 113 | for (section in node.content.sections.filter { it.subjectName == null }) { |
| 114 | appendLine(to, formatStrong(formatText(section.tag))) |
| 115 | appendLine(to, formatText(location, section)) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 116 | } |
| 117 | } |
| 118 | |
Dmitry Jemerov | 0fac1d9 | 2015-01-30 19:01:40 +0100 | [diff] [blame] | 119 | fun Content.getSectionsWithSubjects(): Map<String, List<ContentSection>> = |
| 120 | sections.filter { it.subjectName != null }.groupBy { it.tag } |
| 121 | |
| 122 | fun appendSectionWithSubject(title: String, location: Location, subjectSections: List<ContentSection>, to: StringBuilder) { |
Dmitry Jemerov | bfd9ffd | 2015-01-30 17:59:15 +0100 | [diff] [blame] | 123 | appendHeader(to, title, 3) |
Dmitry Jemerov | 0fac1d9 | 2015-01-30 19:01:40 +0100 | [diff] [blame] | 124 | subjectSections.forEach { |
| 125 | val subjectName = it.subjectName |
| 126 | if (subjectName != null) { |
| 127 | to.append(formatCode(subjectName)).append(" - ") |
| 128 | to.append(formatText(location, it)) |
Dmitry Jemerov | bfd9ffd | 2015-01-30 17:59:15 +0100 | [diff] [blame] | 129 | appendLine(to) |
| 130 | } |
| 131 | } |
Dmitry Jemerov | c43a437 | 2014-12-29 20:22:43 +0100 | [diff] [blame] | 132 | } |
| 133 | |
Dmitry Jemerov | 0dd5ea3 | 2015-01-14 13:30:43 +0100 | [diff] [blame] | 134 | private fun DocumentationNode.appendOverrides(to: StringBuilder) { |
| 135 | overrides.forEach { |
| 136 | to.append("Overrides ") |
Dmitry Jemerov | ea1f4cc | 2015-02-19 19:51:01 +0100 | [diff] [blame^] | 137 | val location = locationService.relativePathToLocation(this, it) |
Dmitry Jemerov | 0dd5ea3 | 2015-01-14 13:30:43 +0100 | [diff] [blame] | 138 | appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location))) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | private fun DocumentationNode.appendDeprecation(to: StringBuilder) { |
| 143 | if (deprecation != null) { |
| 144 | val deprecationParameter = deprecation!!.details(DocumentationNode.Kind.Parameter).firstOrNull() |
| 145 | val deprecationValue = deprecationParameter?.details(DocumentationNode.Kind.Value)?.firstOrNull() |
| 146 | if (deprecationValue != null) { |
| 147 | to.append(formatStrong("Deprecated: ")) |
| 148 | appendLine(to, formatText(deprecationValue.name.trim("\""))) |
| 149 | } else { |
| 150 | appendLine(to, formatStrong("Deprecated")) |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | |
Dmitry Jemerov | 6146fa8 | 2015-01-14 18:46:36 +0100 | [diff] [blame] | 155 | private fun DocumentationNode.appendSourceLink(to: StringBuilder) { |
| 156 | val sourceUrl = details(DocumentationNode.Kind.SourceUrl).firstOrNull() |
| 157 | if (sourceUrl != null) { |
Dmitry Jemerov | ebbf265 | 2015-02-10 19:35:27 +0100 | [diff] [blame] | 158 | to.append(" ") |
| 159 | appendLine(to, formatLink("(source)", sourceUrl.name)) |
| 160 | } else { |
| 161 | appendLine(to) |
Dmitry Jemerov | 6146fa8 | 2015-01-14 18:46:36 +0100 | [diff] [blame] | 162 | } |
| 163 | } |
| 164 | |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 165 | fun appendLocation(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) { |
Ilya Ryzhenkov | bd494a8 | 2014-08-21 19:53:36 +0400 | [diff] [blame] | 166 | val breakdownByName = nodes.groupBy { node -> node.name } |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 167 | for ((name, items) in breakdownByName) { |
Ilya Ryzhenkov | aa59acb | 2014-07-15 20:05:55 +0400 | [diff] [blame] | 168 | appendHeader(to, formatText(name)) |
Dmitry Jemerov | e1a3884 | 2015-02-10 18:55:12 +0100 | [diff] [blame] | 169 | appendDocumentation(location, to, items) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 173 | private fun StructuredFormatService.appendSection(location: Location, caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) { |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 174 | if (nodes.any()) { |
| 175 | appendHeader(to, caption, 3) |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 176 | |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 177 | val children = nodes.sortBy { it.name } |
| 178 | val membersMap = children.groupBy { link(node, it) } |
Ilya Ryzhenkov | aa59acb | 2014-07-15 20:05:55 +0400 | [diff] [blame] | 179 | |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 180 | appendTable(to) { |
| 181 | appendTableBody(to) { |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 182 | for ((memberLocation, members) in membersMap) { |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 183 | appendTableRow(to) { |
| 184 | appendTableCell(to) { |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 185 | to.append(formatLink(memberLocation)) |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 186 | } |
| 187 | appendTableCell(to) { |
Ilya Ryzhenkov | 280dc29 | 2014-10-14 16:08:10 +0400 | [diff] [blame] | 188 | val breakdownBySummary = members.groupBy { formatText(location, it.summary) } |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 189 | for ((summary, items) in breakdownBySummary) { |
Dmitry Jemerov | 3fc3e33 | 2014-12-30 15:35:00 +0100 | [diff] [blame] | 190 | val signatureTexts = items map { signature -> |
Dmitry Jemerov | 0c584d0 | 2015-01-12 17:23:07 +0100 | [diff] [blame] | 191 | val signature = languageService.render(signature, RenderMode.SUMMARY) |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 192 | val signatureAsCode = ContentCode() |
| 193 | signatureAsCode.append(signature) |
Dmitry Jemerov | 3fc3e33 | 2014-12-30 15:35:00 +0100 | [diff] [blame] | 194 | formatText(location, signatureAsCode) |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 195 | } |
Dmitry Jemerov | 3fc3e33 | 2014-12-30 15:35:00 +0100 | [diff] [blame] | 196 | signatureTexts.subList(0, signatureTexts.size()-1).forEach { |
| 197 | appendLine(to, it) |
| 198 | } |
| 199 | to.append(signatureTexts.last()) |
Ilya Ryzhenkov | a52e1d5 | 2014-10-03 15:57:16 +0400 | [diff] [blame] | 200 | if (!summary.isEmpty()) { |
Dmitry Jemerov | 8ef6818 | 2014-12-30 12:36:14 +0100 | [diff] [blame] | 201 | to.append(summary) |
Ilya Ryzhenkov | aa59acb | 2014-07-15 20:05:55 +0400 | [diff] [blame] | 202 | } |
| 203 | } |
| 204 | } |
Ilya Ryzhenkov | e8447fd | 2014-07-15 16:37:50 +0400 | [diff] [blame] | 205 | } |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 206 | } |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 207 | } |
| 208 | } |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 212 | override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) { |
| 213 | val breakdownByLocation = nodes.groupBy { node -> |
Dmitry Jemerov | d9bfa02 | 2015-02-19 18:59:00 +0100 | [diff] [blame] | 214 | formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) }) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | for ((breadcrumbs, items) in breakdownByLocation) { |
| 218 | appendLine(to, breadcrumbs) |
| 219 | appendLine(to) |
Dmitry Jemerov | 4b0dcee | 2015-01-09 19:48:44 +0100 | [diff] [blame] | 220 | appendLocation(location, to, items.filter { it.kind != DocumentationNode.Kind.ExternalClass }) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | for (node in nodes) { |
Dmitry Jemerov | 4b0dcee | 2015-01-09 19:48:44 +0100 | [diff] [blame] | 224 | if (node.kind == DocumentationNode.Kind.ExternalClass) { |
| 225 | appendSection(location, "Extensions for ${node.name}", node.members, node, to) |
| 226 | continue |
| 227 | } |
| 228 | |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 229 | appendSection(location, "Packages", node.members(DocumentationNode.Kind.Package), node, to) |
| 230 | appendSection(location, "Types", node.members.filter { |
| 231 | it.kind in setOf( |
| 232 | DocumentationNode.Kind.Class, |
| 233 | DocumentationNode.Kind.Interface, |
| 234 | DocumentationNode.Kind.Enum, |
Dmitry Jemerov | 716483c | 2014-12-30 17:41:14 +0100 | [diff] [blame] | 235 | DocumentationNode.Kind.Object, |
| 236 | DocumentationNode.Kind.AnnotationClass) |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 237 | }, node, to) |
Dmitry Jemerov | 4b0dcee | 2015-01-09 19:48:44 +0100 | [diff] [blame] | 238 | appendSection(location, "Extensions for External Classes", node.members(DocumentationNode.Kind.ExternalClass), node, to) |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 239 | appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to) |
| 240 | appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to) |
| 241 | appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to) |
Dmitry Jemerov | 2822a3e | 2015-02-17 12:32:17 +0100 | [diff] [blame] | 242 | appendSection(location, "Default Object Properties", node.members(DocumentationNode.Kind.DefaultObjectProperty), node, to) |
| 243 | appendSection(location, "Default Object Functions", node.members(DocumentationNode.Kind.DefaultObjectFunction), node, to) |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 244 | appendSection(location, "Accessors", node.members(DocumentationNode.Kind.PropertyAccessor), node, to) |
Dmitry Jemerov | c4f40a0 | 2015-01-12 16:32:30 +0100 | [diff] [blame] | 245 | appendSection(location, "Enum Values", node.members(DocumentationNode.Kind.EnumItem), node, to) |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 246 | appendSection(location, "Other members", node.members.filter { |
| 247 | it.kind !in setOf( |
| 248 | DocumentationNode.Kind.Class, |
| 249 | DocumentationNode.Kind.Interface, |
Dmitry Jemerov | 716483c | 2014-12-30 17:41:14 +0100 | [diff] [blame] | 250 | DocumentationNode.Kind.Enum, |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 251 | DocumentationNode.Kind.Object, |
Dmitry Jemerov | 716483c | 2014-12-30 17:41:14 +0100 | [diff] [blame] | 252 | DocumentationNode.Kind.AnnotationClass, |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 253 | DocumentationNode.Kind.Constructor, |
| 254 | DocumentationNode.Kind.Property, |
| 255 | DocumentationNode.Kind.Package, |
| 256 | DocumentationNode.Kind.Function, |
Dmitry Jemerov | cedaeb4 | 2014-12-29 20:50:26 +0100 | [diff] [blame] | 257 | DocumentationNode.Kind.PropertyAccessor, |
Dmitry Jemerov | 2822a3e | 2015-02-17 12:32:17 +0100 | [diff] [blame] | 258 | DocumentationNode.Kind.DefaultObjectProperty, |
| 259 | DocumentationNode.Kind.DefaultObjectFunction, |
Dmitry Jemerov | c4f40a0 | 2015-01-12 16:32:30 +0100 | [diff] [blame] | 260 | DocumentationNode.Kind.ExternalClass, |
| 261 | DocumentationNode.Kind.EnumItem |
Ilya Ryzhenkov | 4907736 | 2014-10-14 19:53:13 +0400 | [diff] [blame] | 262 | ) |
| 263 | }, node, to) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 264 | appendSection(location, "Extensions", node.extensions, node, to) |
Dmitry Jemerov | c4f40a0 | 2015-01-12 16:32:30 +0100 | [diff] [blame] | 265 | appendSection(location, "Inheritors", |
| 266 | node.inheritors.filter { it.kind != DocumentationNode.Kind.EnumItem }, node, to) |
Ilya Ryzhenkov | d6fd045 | 2014-10-03 20:20:02 +0400 | [diff] [blame] | 267 | appendSection(location, "Links", node.links, node, to) |
| 268 | |
| 269 | } |
| 270 | } |
Ilya Ryzhenkov | 62cb509 | 2014-07-15 15:54:05 +0400 | [diff] [blame] | 271 | } |