diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-12 19:04:53 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-01-12 19:04:53 +0100 |
commit | f3ed9f5fa553c72a254e5ca5d28e108849937769 (patch) | |
tree | 76d4dd6239da5ca01bddd35a54b8427d550c9e4f /core/src/main/kotlin/Kotlin | |
parent | a3ec2e2afd6f4140ac78f7630fa9c2ca1f8ca8af (diff) | |
download | dokka-f3ed9f5fa553c72a254e5ca5d28e108849937769.tar.gz dokka-f3ed9f5fa553c72a254e5ca5d28e108849937769.tar.bz2 dokka-f3ed9f5fa553c72a254e5ca5d28e108849937769.zip |
generate all types index
Diffstat (limited to 'core/src/main/kotlin/Kotlin')
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 3c4c0c39..1bc41f54 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -293,6 +293,7 @@ class DocumentationBuilder } propagateExtensionFunctionsToSubclasses(fragments) + generateAllTypesNode() } private fun propagateExtensionFunctionsToSubclasses(fragments: Collection<PackageFragmentDescriptor>) { @@ -356,6 +357,19 @@ class DocumentationBuilder return false } + private fun DocumentationNode.generateAllTypesNode() { + val allTypes = members(NodeKind.Package) + .flatMap { it.members.filter { it.kind in NodeKind.classLike || it.kind == NodeKind.ExternalClass } } + .sortedBy { if (it.kind == NodeKind.ExternalClass) it.name.substringAfterLast('.') else it.name } + + val allTypesNode = DocumentationNode("alltypes", Content.Empty, NodeKind.AllTypes) + for (typeNode in allTypes) { + allTypesNode.addReferenceTo(typeNode, RefKind.Member) + } + + append(allTypesNode, RefKind.Member) + } + fun DeclarationDescriptor.build(): DocumentationNode = when (this) { is ClassDescriptor -> build() is ConstructorDescriptor -> build() |