blob: 7b9374ecb7a0e06282b6b6e43223efd0248f90d4 [file] [log] [blame]
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +04001package org.jetbrains.dokka
2
3import java.util.LinkedHashMap
Dmitry Jemerov0c584d02015-01-12 17:23:07 +01004import org.jetbrains.dokka.LanguageService.RenderMode
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +04005
Dmitry Jemerovd9bfa022015-02-19 18:59:00 +01006public data class FormatLink(val text: String, val href: String)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +04007
Dmitry Jemerov66593372015-03-03 19:35:56 +01008enum class ListKind {
9 Ordered
10 Unordered
11}
12
Dmitry Jemerovea1f4cc2015-02-19 19:51:01 +010013public abstract class StructuredFormatService(locationService: LocationService,
14 val languageService: LanguageService,
15 override val extension: String) : FormatService {
16 val locationService: LocationService = locationService.withExtension(extension)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040017
Dmitry Jemerov44cef5c2015-02-26 19:34:49 +010018 abstract public fun appendBlockCode(to: StringBuilder, line: String, language: String)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040019 abstract public fun appendHeader(to: StringBuilder, text: String, level: Int = 1)
Dmitry Jemerov8ef68182014-12-30 12:36:14 +010020 abstract public fun appendParagraph(to: StringBuilder, text: String)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040021 abstract public fun appendLine(to: StringBuilder, text: String)
22 public abstract fun appendLine(to: StringBuilder)
Dmitry Jemerov85a3ae72015-02-20 14:08:30 +010023 public abstract fun appendAnchor(to: StringBuilder, anchor: String)
Ilya Ryzhenkov499d0822014-07-15 16:18:53 +040024
Ilya Ryzhenkovaa59acb2014-07-15 20:05:55 +040025 public abstract fun appendTable(to: StringBuilder, body: () -> Unit)
26 public abstract fun appendTableHeader(to: StringBuilder, body: () -> Unit)
27 public abstract fun appendTableBody(to: StringBuilder, body: () -> Unit)
28 public abstract fun appendTableRow(to: StringBuilder, body: () -> Unit)
29 public abstract fun appendTableCell(to: StringBuilder, body: () -> Unit)
Ilya Ryzhenkov499d0822014-07-15 16:18:53 +040030
Ilya Ryzhenkovaa59acb2014-07-15 20:05:55 +040031 public abstract fun formatText(text: String): String
Ilya Ryzhenkov7c6da4b2014-10-03 19:09:31 +040032 public abstract fun formatSymbol(text: String): String
33 public abstract fun formatKeyword(text: String): String
Dmitry Jemerov4494fd02015-02-26 21:34:27 +010034 public abstract fun formatIdentifier(text: String, kind: IdentifierKind): String
Ilya Ryzhenkov71cd87e2014-10-03 22:51:44 +040035 public abstract fun formatLink(text: String, href: String): String
Dmitry Jemerovd9bfa022015-02-19 18:59:00 +010036 public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href)
Ilya Ryzhenkov9f0ff552014-10-13 13:38:40 +040037 public abstract fun formatStrong(text: String): String
Dmitry Jemerove17eaa52015-01-09 20:59:58 +010038 public abstract fun formatStrikethrough(text: String): String
Ilya Ryzhenkov9f0ff552014-10-13 13:38:40 +040039 public abstract fun formatEmphasis(text: String): String
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040040 public abstract fun formatCode(code: String): String
Dmitry Jemerov66593372015-03-03 19:35:56 +010041 public abstract fun formatUnorderedList(text: String): String
42 public abstract fun formatOrderedList(text: String): String
43 public abstract fun formatListItem(text: String, kind: ListKind): String
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040044 public abstract fun formatBreadcrumbs(items: Iterable<FormatLink>): String
Dmitry Jemerov722c9af2015-02-26 16:28:05 +010045 public abstract fun formatNonBreakingSpace(): String
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040046
Dmitry Jemerov66593372015-03-03 19:35:56 +010047 open fun formatText(location: Location, nodes: Iterable<ContentNode>, listKind: ListKind = ListKind.Unordered): String {
48 return nodes.map { formatText(location, it, listKind) }.join("")
Ilya Ryzhenkov778e2b32014-09-29 20:54:59 +040049 }
50
Dmitry Jemerov66593372015-03-03 19:35:56 +010051 open fun formatText(location: Location, content: ContentNode, listKind: ListKind = ListKind.Unordered): String {
Ilya Ryzhenkov455d74a2014-09-19 22:25:27 +030052 return StringBuilder {
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +040053 when (content) {
Dmitry Jemerov8ef68182014-12-30 12:36:14 +010054 is ContentText -> append(formatText(content.text))
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +040055 is ContentSymbol -> append(formatSymbol(content.text))
56 is ContentKeyword -> append(formatKeyword(content.text))
Dmitry Jemerov4494fd02015-02-26 21:34:27 +010057 is ContentIdentifier -> append(formatIdentifier(content.text, content.kind))
Dmitry Jemerov722c9af2015-02-26 16:28:05 +010058 is ContentNonBreakingSpace -> append(formatNonBreakingSpace())
Ilya Ryzhenkov9f0ff552014-10-13 13:38:40 +040059 is ContentStrong -> append(formatStrong(formatText(location, content.children)))
Dmitry Jemerove17eaa52015-01-09 20:59:58 +010060 is ContentStrikethrough -> append(formatStrikethrough(formatText(location, content.children)))
Ilya Ryzhenkov9f0ff552014-10-13 13:38:40 +040061 is ContentCode -> append(formatCode(formatText(location, content.children)))
62 is ContentEmphasis -> append(formatEmphasis(formatText(location, content.children)))
Dmitry Jemerov66593372015-03-03 19:35:56 +010063 is ContentUnorderedList -> append(formatUnorderedList(formatText(location, content.children, ListKind.Unordered)))
64 is ContentOrderedList -> append(formatOrderedList(formatText(location, content.children, ListKind.Ordered)))
65 is ContentListItem -> append(formatListItem(formatText(location, content.children), listKind))
Ilya Ryzhenkov18399492014-12-22 09:50:17 +020066
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +040067 is ContentNodeLink -> {
Dmitry Jemerov184a24c2015-02-25 19:03:51 +010068 val node = content.node
69 val linkTo = if (node != null) locationHref(location, node) else "#"
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +040070 val linkText = formatText(location, content.children)
Dmitry Jemerov4b61be32015-02-26 21:17:13 +010071 if (linkTo == ".") {
72 append(linkText)
73 } else {
74 append(formatLink(linkText, linkTo))
75 }
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +040076 }
Ilya Ryzhenkov71cd87e2014-10-03 22:51:44 +040077 is ContentExternalLink -> {
78 val linkText = formatText(location, content.children)
Dmitry Jemerov4b61be32015-02-26 21:17:13 +010079 if (content.href == ".") {
80 append(linkText)
81 } else {
82 append(formatLink(linkText, content.href))
83 }
Ilya Ryzhenkov71cd87e2014-10-03 22:51:44 +040084 }
Ilya Ryzhenkovad14ea92014-10-13 18:22:02 +040085 is ContentParagraph -> {
Dmitry Jemerov8ef68182014-12-30 12:36:14 +010086 appendParagraph(this, formatText(location, content.children))
Ilya Ryzhenkovad14ea92014-10-13 18:22:02 +040087 }
Ilya Ryzhenkov1cb3af92014-10-13 20:14:45 +040088 is ContentBlockCode -> {
Dmitry Jemerov44cef5c2015-02-26 19:34:49 +010089 appendBlockCode(this, formatText(location, content.children), content.language)
Ilya Ryzhenkov1cb3af92014-10-13 20:14:45 +040090 }
Dmitry Jemerov0d0fc1f2015-02-10 18:32:12 +010091 is ContentBlock -> append(formatText(location, content.children))
Ilya Ryzhenkov455d74a2014-09-19 22:25:27 +030092 }
93 }.toString()
94 }
95
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +040096 open public fun link(from: DocumentationNode, to: DocumentationNode): FormatLink = link(from, to, extension)
97
98 open public fun link(from: DocumentationNode, to: DocumentationNode, extension: String): FormatLink {
Dmitry Jemerovea1f4cc2015-02-19 19:51:01 +010099 return FormatLink(to.name, locationService.relativePathToLocation(from, to))
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400100 }
101
Dmitry Jemerov85a3ae72015-02-20 14:08:30 +0100102 fun locationHref(from: Location, to: DocumentationNode): String {
103 val topLevelPage = to.references(DocumentationReference.Kind.TopLevelPage).singleOrNull()?.to
104 if (topLevelPage != null) {
105 return from.relativePathTo(locationService.location(topLevelPage), to.name)
106 }
107 return from.relativePathTo(locationService.location(to))
108 }
109
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100110 fun appendDocumentation(location: Location, to: StringBuilder, overloads: Iterable<DocumentationNode>) {
111 val breakdownBySummary = overloads.groupByTo(LinkedHashMap()) { node -> node.content }
Dmitry Jemerovbfd9ffd2015-01-30 17:59:15 +0100112
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100113 for ((summary, items) in breakdownBySummary) {
114 items.forEach {
Dmitry Jemerovf90ee502015-02-26 13:55:37 +0100115 appendAsSignature(to) {
116 to.append(formatCode(formatText(location, languageService.render(it))))
117 it.appendSourceLink(to)
118 }
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100119 it.appendOverrides(to)
Dmitry Jemerova60d8ba2015-02-24 16:24:00 +0100120 it.appendDeprecation(location, to)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400121 }
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100122 // All items have exactly the same documentation, so we can use any item to render it
123 val item = items.first()
Dmitry Jemerovf4623172015-03-02 16:17:28 +0100124 item.details(DocumentationNode.Kind.OverloadGroupNote).forEach {
125 to.append(formatText(location, it.content))
126 }
Dmitry Jemerovebbf2652015-02-10 19:35:27 +0100127 to.append(formatText(location, item.content.summary))
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100128 appendDescription(location, to, item)
Dmitry Jemerovebbf2652015-02-10 19:35:27 +0100129 appendLine(to)
130 appendLine(to)
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100131 }
132 }
133
Dmitry Jemerovf90ee502015-02-26 13:55:37 +0100134 protected open fun appendAsSignature(to: StringBuilder, block: () -> Unit) {
135 block()
136 }
137
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100138 fun appendDescription(location: Location, to: StringBuilder, node: DocumentationNode) {
139 if (node.content.description != ContentEmpty) {
140 appendHeader(to, "Description", 3)
141 appendLine(to, formatText(location, node.content.description))
142 appendLine(to)
143 }
144 node.content.getSectionsWithSubjects().forEach {
145 appendSectionWithSubject(it.getKey(), location, it.getValue(), to)
146 }
147
148 for (section in node.content.sections.filter { it.subjectName == null }) {
149 appendLine(to, formatStrong(formatText(section.tag)))
150 appendLine(to, formatText(location, section))
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400151 }
152 }
153
Dmitry Jemerov0fac1d92015-01-30 19:01:40 +0100154 fun Content.getSectionsWithSubjects(): Map<String, List<ContentSection>> =
155 sections.filter { it.subjectName != null }.groupBy { it.tag }
156
157 fun appendSectionWithSubject(title: String, location: Location, subjectSections: List<ContentSection>, to: StringBuilder) {
Dmitry Jemerovbfd9ffd2015-01-30 17:59:15 +0100158 appendHeader(to, title, 3)
Dmitry Jemerov0fac1d92015-01-30 19:01:40 +0100159 subjectSections.forEach {
160 val subjectName = it.subjectName
161 if (subjectName != null) {
Dmitry Jemerov85a3ae72015-02-20 14:08:30 +0100162 appendAnchor(to, subjectName)
Dmitry Jemerov0fac1d92015-01-30 19:01:40 +0100163 to.append(formatCode(subjectName)).append(" - ")
164 to.append(formatText(location, it))
Dmitry Jemerovbfd9ffd2015-01-30 17:59:15 +0100165 appendLine(to)
166 }
167 }
Dmitry Jemerovc43a4372014-12-29 20:22:43 +0100168 }
169
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100170 private fun DocumentationNode.appendOverrides(to: StringBuilder) {
171 overrides.forEach {
172 to.append("Overrides ")
Dmitry Jemerovea1f4cc2015-02-19 19:51:01 +0100173 val location = locationService.relativePathToLocation(this, it)
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100174 appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location)))
175 }
176 }
177
Dmitry Jemerova60d8ba2015-02-24 16:24:00 +0100178 private fun DocumentationNode.appendDeprecation(location: Location, to: StringBuilder) {
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100179 if (deprecation != null) {
180 val deprecationParameter = deprecation!!.details(DocumentationNode.Kind.Parameter).firstOrNull()
181 val deprecationValue = deprecationParameter?.details(DocumentationNode.Kind.Value)?.firstOrNull()
182 if (deprecationValue != null) {
Dmitry Jemerov7003ad82015-02-26 13:20:41 +0100183 to.append(formatStrong("Deprecated:")).append(" ")
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100184 appendLine(to, formatText(deprecationValue.name.trim("\"")))
Dmitry Jemerovf7c2f2a2015-02-26 19:45:36 +0100185 appendLine(to)
Dmitry Jemerova60d8ba2015-02-24 16:24:00 +0100186 } else if (deprecation?.content != Content.Empty) {
Dmitry Jemerov7003ad82015-02-26 13:20:41 +0100187 to.append(formatStrong("Deprecated:")).append(" ")
Dmitry Jemerova60d8ba2015-02-24 16:24:00 +0100188 to.append(formatText(location, deprecation!!.content))
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100189 } else {
190 appendLine(to, formatStrong("Deprecated"))
Dmitry Jemerovf7c2f2a2015-02-26 19:45:36 +0100191 appendLine(to)
Dmitry Jemerov0dd5ea32015-01-14 13:30:43 +0100192 }
193 }
194 }
195
Dmitry Jemerov6146fa82015-01-14 18:46:36 +0100196 private fun DocumentationNode.appendSourceLink(to: StringBuilder) {
197 val sourceUrl = details(DocumentationNode.Kind.SourceUrl).firstOrNull()
198 if (sourceUrl != null) {
Dmitry Jemerovebbf2652015-02-10 19:35:27 +0100199 to.append(" ")
200 appendLine(to, formatLink("(source)", sourceUrl.name))
201 } else {
202 appendLine(to)
Dmitry Jemerov6146fa82015-01-14 18:46:36 +0100203 }
204 }
205
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400206 fun appendLocation(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
Ilya Ryzhenkovbd494a82014-08-21 19:53:36 +0400207 val breakdownByName = nodes.groupBy { node -> node.name }
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400208 for ((name, items) in breakdownByName) {
Ilya Ryzhenkovaa59acb2014-07-15 20:05:55 +0400209 appendHeader(to, formatText(name))
Dmitry Jemerove1a38842015-02-10 18:55:12 +0100210 appendDocumentation(location, to, items)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400211 }
212 }
213
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400214 private fun StructuredFormatService.appendSection(location: Location, caption: String, nodes: List<DocumentationNode>, node: DocumentationNode, to: StringBuilder) {
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400215 if (nodes.any()) {
216 appendHeader(to, caption, 3)
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400217
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400218 val children = nodes.sortBy { it.name }
219 val membersMap = children.groupBy { link(node, it) }
Ilya Ryzhenkovaa59acb2014-07-15 20:05:55 +0400220
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400221 appendTable(to) {
222 appendTableBody(to) {
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400223 for ((memberLocation, members) in membersMap) {
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400224 appendTableRow(to) {
225 appendTableCell(to) {
Dmitry Jemerov8ef68182014-12-30 12:36:14 +0100226 to.append(formatLink(memberLocation))
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400227 }
228 appendTableCell(to) {
Ilya Ryzhenkov280dc292014-10-14 16:08:10 +0400229 val breakdownBySummary = members.groupBy { formatText(location, it.summary) }
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400230 for ((summary, items) in breakdownBySummary) {
Dmitry Jemerov3fc3e332014-12-30 15:35:00 +0100231 val signatureTexts = items map { signature ->
Dmitry Jemerov7170d632015-03-02 14:35:47 +0100232 val signatureText = languageService.render(signature, RenderMode.SUMMARY)
Dmitry Jemerov8ef68182014-12-30 12:36:14 +0100233 val signatureAsCode = ContentCode()
Dmitry Jemerov7170d632015-03-02 14:35:47 +0100234 signatureAsCode.append(signatureText)
Dmitry Jemerov3fc3e332014-12-30 15:35:00 +0100235 formatText(location, signatureAsCode)
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400236 }
Dmitry Jemerov3fc3e332014-12-30 15:35:00 +0100237 signatureTexts.subList(0, signatureTexts.size()-1).forEach {
Dmitry Jemerov86a6db82015-02-26 14:40:02 +0100238 appendAsSignature(to) {
239 appendLine(to, it)
240 }
Dmitry Jemerov3fc3e332014-12-30 15:35:00 +0100241 }
Dmitry Jemerovf90ee502015-02-26 13:55:37 +0100242 appendAsSignature(to) {
243 to.append(signatureTexts.last())
244 }
Ilya Ryzhenkova52e1d52014-10-03 15:57:16 +0400245 if (!summary.isEmpty()) {
Dmitry Jemerov8ef68182014-12-30 12:36:14 +0100246 to.append(summary)
Ilya Ryzhenkovaa59acb2014-07-15 20:05:55 +0400247 }
248 }
249 }
Ilya Ryzhenkove8447fd2014-07-15 16:37:50 +0400250 }
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400251 }
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400252 }
253 }
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400254 }
255 }
256
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400257 override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) {
258 val breakdownByLocation = nodes.groupBy { node ->
Dmitry Jemerovd9bfa022015-02-19 18:59:00 +0100259 formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) })
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400260 }
261
262 for ((breadcrumbs, items) in breakdownByLocation) {
263 appendLine(to, breadcrumbs)
264 appendLine(to)
Dmitry Jemerov4b0dcee2015-01-09 19:48:44 +0100265 appendLocation(location, to, items.filter { it.kind != DocumentationNode.Kind.ExternalClass })
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400266 }
267
268 for (node in nodes) {
Dmitry Jemerov4b0dcee2015-01-09 19:48:44 +0100269 if (node.kind == DocumentationNode.Kind.ExternalClass) {
270 appendSection(location, "Extensions for ${node.name}", node.members, node, to)
271 continue
272 }
273
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400274 appendSection(location, "Packages", node.members(DocumentationNode.Kind.Package), node, to)
275 appendSection(location, "Types", node.members.filter {
276 it.kind in setOf(
277 DocumentationNode.Kind.Class,
278 DocumentationNode.Kind.Interface,
279 DocumentationNode.Kind.Enum,
Dmitry Jemerov716483c2014-12-30 17:41:14 +0100280 DocumentationNode.Kind.Object,
281 DocumentationNode.Kind.AnnotationClass)
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400282 }, node, to)
Dmitry Jemerov4b0dcee2015-01-09 19:48:44 +0100283 appendSection(location, "Extensions for External Classes", node.members(DocumentationNode.Kind.ExternalClass), node, to)
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400284 appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to)
285 appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to)
286 appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to)
Dmitry Jemerov2822a3e2015-02-17 12:32:17 +0100287 appendSection(location, "Default Object Properties", node.members(DocumentationNode.Kind.DefaultObjectProperty), node, to)
288 appendSection(location, "Default Object Functions", node.members(DocumentationNode.Kind.DefaultObjectFunction), node, to)
Dmitry Jemerovc4f40a02015-01-12 16:32:30 +0100289 appendSection(location, "Enum Values", node.members(DocumentationNode.Kind.EnumItem), node, to)
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400290 appendSection(location, "Other members", node.members.filter {
291 it.kind !in setOf(
292 DocumentationNode.Kind.Class,
293 DocumentationNode.Kind.Interface,
Dmitry Jemerov716483c2014-12-30 17:41:14 +0100294 DocumentationNode.Kind.Enum,
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400295 DocumentationNode.Kind.Object,
Dmitry Jemerov716483c2014-12-30 17:41:14 +0100296 DocumentationNode.Kind.AnnotationClass,
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400297 DocumentationNode.Kind.Constructor,
298 DocumentationNode.Kind.Property,
299 DocumentationNode.Kind.Package,
300 DocumentationNode.Kind.Function,
Dmitry Jemerov2822a3e2015-02-17 12:32:17 +0100301 DocumentationNode.Kind.DefaultObjectProperty,
302 DocumentationNode.Kind.DefaultObjectFunction,
Dmitry Jemerovc4f40a02015-01-12 16:32:30 +0100303 DocumentationNode.Kind.ExternalClass,
304 DocumentationNode.Kind.EnumItem
Ilya Ryzhenkov49077362014-10-14 19:53:13 +0400305 )
306 }, node, to)
Dmitry Jemerov4f590342015-02-26 19:19:55 +0100307 appendSection(location, "Extension Properties", node.extensions.filter { it.kind == DocumentationNode.Kind.Property }, node, to)
308 appendSection(location, "Extension Functions", node.extensions.filter { it.kind == DocumentationNode.Kind.Function }, node, to)
Dmitry Jemerovc4f40a02015-01-12 16:32:30 +0100309 appendSection(location, "Inheritors",
310 node.inheritors.filter { it.kind != DocumentationNode.Kind.EnumItem }, node, to)
Ilya Ryzhenkovd6fd0452014-10-03 20:20:02 +0400311 appendSection(location, "Links", node.links, node, to)
312
313 }
314 }
Ilya Ryzhenkov62cb5092014-07-15 15:54:05 +0400315}