diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-08-10 22:55:20 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-09-07 10:30:26 +0200 |
commit | 270ff58ea44b7700be45062f75bbc7fd50d183eb (patch) | |
tree | 6ed2932da200032bcc0362f5d1a11ac2152e93bc /plugins/javadoc/src/main | |
parent | 7a4e70f5e82f8ccc7c5a5122b65a7854ae5973bc (diff) | |
download | dokka-270ff58ea44b7700be45062f75bbc7fd50d183eb.tar.gz dokka-270ff58ea44b7700be45062f75bbc7fd50d183eb.tar.bz2 dokka-270ff58ea44b7700be45062f75bbc7fd50d183eb.zip |
Adding missing subclasses pages
Diffstat (limited to 'plugins/javadoc/src/main')
6 files changed, 30 insertions, 12 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt index 45d8c61f..4e5f2689 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt @@ -37,13 +37,14 @@ open class JavadocPageCreator( fun pageForPackage(p: DPackage) = JavadocPackagePageNode(p.name, contentForPackage(p), setOf(p.dri), p, - p.classlikes.mapNotNull { pageForClasslike(it) } // TODO: nested classlikes + p.classlikes.mapNotNull { pageForClasslike(it) } ) fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? = c.highestJvmSourceSet?.let { jvm -> + var children = c.classlikes.mapNotNull { pageForClasslike(it) } JavadocClasslikePageNode( - name = c.name.orEmpty(), + name = c.dri.classNames.orEmpty(), content = contentForClasslike(c), dri = setOf(c.dri), brief = c.brief(), @@ -60,7 +61,7 @@ open class JavadocPageCreator( PropertyContainer.withAll(it.indexesInDocumentation()) ) }.orEmpty(), - classlikes = c.classlikes.mapNotNull { pageForClasslike(it) }, + classlikes = children, properties = c.properties.map { JavadocPropertyNode( it.dri, @@ -71,6 +72,7 @@ open class JavadocPageCreator( ) }, documentable = c, + children = children, extra = ((c as? WithExtraProperties<Documentable>)?.extra ?: PropertyContainer.empty()) + c.indexesInDocumentation() ) @@ -102,7 +104,8 @@ open class JavadocPageCreator( p.jvmSourceSets.toDisplaySourceSets() ) { title("Package ${p.name}", p.brief(), dri = setOf(p.dri), kind = ContentKind.Packages) - val rootList = p.classlikes.groupBy { it::class }.map { (key, value) -> + fun allClasslikes(c: DClasslike): List<DClasslike> = c.classlikes.flatMap { allClasslikes(it) } + c + val rootList = p.classlikes.map { allClasslikes(it) }.flatten().groupBy { it::class }.map { (key, value) -> JavadocList(key.tabTitle, key.colTitle, value.map { c -> RowJavadocListEntry( LinkJavadocListEntry(c.name ?: "", setOf(c.dri), JavadocContentKind.Class, sourceSets), diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt index 4b775f29..a7e10bd5 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt @@ -90,7 +90,8 @@ object IndexGenerator : PageTransformer { elements.getOrPut(it.name[0].toUpperCase(), ::mutableSetOf).add(it) } val keys = elements.keys.sortedBy { it } - return input.modified(children = input.children + elements.entries.mapIndexed { i, (_, set) -> + val sortedElements = elements.entries.sortedBy { (a, _) -> a } + return input.modified(children = input.children + sortedElements.mapIndexed { i, (_, set) -> IndexPage(i + 1, set.sortedBy { it.getId().toLowerCase() }, keys, input.sourceSets()) }) } @@ -127,10 +128,18 @@ object DeprecatedPageCreator : PageTransformer { node.children.filterIsInstance<NavigableJavadocNode>().forEach(::verifyDeprecation) is JavadocClasslikePageNode -> { node.classlikes.forEach(::verifyDeprecation) - node.methods.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedMethods) } - node.constructors.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedConstructors) } - node.properties.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedFields) } - node.entries.forEach { it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants) } + node.methods.forEach { + it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedMethods) + } + node.constructors.forEach { + it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedConstructors) + } + node.properties.forEach { + it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedFields) + } + node.entries.forEach { + it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants) + } node.takeIf { it.isDeprecated() }?.putAs( if ((node.documentable as? WithSupertypes)?.isException == true) DeprecatedPageSection.DeprecatedExceptions else when (node.kind) { diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt index f7305152..15bb625a 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt @@ -236,6 +236,10 @@ internal class JavadocContentToTemplateMapTranslator( return mapOf( "modifiers" to node.signature.modifiers?.let { htmlForContentNode(it, contextNode) }, "signature" to node.name, + "address" to locationProvider.resolve( + contextNode.children.first { (it as? JavadocClasslikePageNode)?.dri?.first() == node.dri.first() }, + contextNode + ).formatToEndWithHtml(), "description" to htmlForContentNodes(node.description, node) ) } diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt index 9e599285..6c2fed58 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt @@ -72,8 +72,10 @@ class SearchScriptsCreator(private val locationProvider: LocationProvider) { url = locationProvider.resolveOrThrow(it).formatToEndWithHtml() ) } + SearchRecord.allPackages + fun allClasses(c: JavadocClasslikePageNode): List<JavadocClasslikePageNode> = + c.children.filterIsInstance<JavadocClasslikePageNode>().flatMap { allClasses(it) } + c val types = input.flatMap { - it.children.filterIsInstance<JavadocClasslikePageNode>().map { classlike -> it to classlike } + it.children.filterIsInstance<JavadocClasslikePageNode>().flatMap { allClasses(it) }.map { classlike -> it to classlike } } val updated = accumulator.copy(packageRecords = packages) return processTypes(types, updated) diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt index 55a311d9..2183fd1c 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt @@ -59,7 +59,7 @@ class JavadocSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLo } } signatureWithoutModifiers { - link(c.name!!, c.dri) + link(c.dri.classNames!!, c.dri) if (c is WithGenerics) { list(c.generics, prefix = "<", suffix = ">") { +buildSignature(it) diff --git a/plugins/javadoc/src/main/resources/views/class.korte b/plugins/javadoc/src/main/resources/views/class.korte index fcb866cb..c9b1d7ef 100644 --- a/plugins/javadoc/src/main/resources/views/class.korte +++ b/plugins/javadoc/src/main/resources/views/class.korte @@ -63,7 +63,7 @@ {% for classlike in classlikes %} <tr class="{{ rowColor(loop.index0) }}"> <td class="colFirst"><code>{{ classlike.modifiers }}</code></td> - <th class="colSecond" scope="row"><code>{{ classlike.signature }}</span></code> + <th class="colSecond" scope="row"><code><a href="{{ classlike.address }}">{{ classlike.signature }}</a></span></code> </th> <td class="colLast">{{ classlike.description|raw }}</td> </tr> |