aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-01-06 02:15:05 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-01-06 02:15:05 +0300
commit66ca7710e79197973d0d1d28031a168ed8e474c5 (patch)
tree29a27cf195571a18836a74eb9970247dc584cd64 /core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
parent4256adfa35db0f5a63a34900e08880aabb195d23 (diff)
downloaddokka-66ca7710e79197973d0d1d28031a168ed8e474c5.tar.gz
Add subclasses info
Diffstat (limited to 'core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt')
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt43
1 files changed, 41 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
index 84778d00d..02d0b3a79 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
@@ -8,7 +8,6 @@ import org.jetbrains.dokka.LanguageService.RenderMode.FULL
import org.jetbrains.dokka.LanguageService.RenderMode.SUMMARY
import org.jetbrains.dokka.NodeKind.Companion.classLike
import java.net.URI
-import java.net.URLEncoder
class JavaLayoutHtmlFormatOutputBuilder(
@@ -210,6 +209,36 @@ class JavaLayoutHtmlFormatOutputBuilder(
}
}
+ private fun FlowContent.subclasses(inheritors: List<DocumentationNode>, direct: Boolean) {
+ if (inheritors.isEmpty()) return
+ div {
+ table {
+ thead {
+ tr {
+ td {
+ if (direct)
+ +"Known Direct Subclasses"
+ else
+ +"Known Indirect Subclasses"
+ }
+ }
+ }
+ tbody {
+ inheritors.forEach {
+ tr {
+ td {
+ a(href = uriProvider.linkTo(it, uri)) { +it.classNodeNameWithOuterClass() }
+ }
+ td {
+ metaMarkup(it.summary)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
fun appendClassLike(node: DocumentationNode) = templateService.composePage(
listOf(node),
htmlConsumer,
@@ -221,6 +250,15 @@ class JavaLayoutHtmlFormatOutputBuilder(
pre { renderedSignature(node, FULL) }
classHierarchy(node)
+ val inheritors = generateSequence(node.inheritors) { inheritors ->
+ inheritors
+ .flatMap { it.inheritors }
+ .takeUnless { it.isEmpty() }
+ }
+ subclasses(inheritors.first(), true)
+ subclasses(inheritors.drop(1).flatten().toList(), false)
+
+
metaMarkup(node.content)
h2 { +"Summary" }
@@ -396,7 +434,8 @@ class ContentToHtmlBuilder(val uriProvider: JavaLayoutHtmlUriProvider, val uri:
is ContentParagraph -> p { appendContent(content.children) }
is ContentNodeLink -> {
- a(href = content.node?.let { uriProvider.linkTo(it, uri) } ?: "#unresolved") { appendContent(content.children) }
+ a(href = content.node?.let { uriProvider.linkTo(it, uri) }
+ ?: "#unresolved") { appendContent(content.children) }
}
is ContentExternalLink -> {
a(href = content.href) { appendContent(content.children) }