diff options
Diffstat (limited to 'src/Model/DocumentationNode.kt')
-rw-r--r-- | src/Model/DocumentationNode.kt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt index c3b9942d..4a77f761 100644 --- a/src/Model/DocumentationNode.kt +++ b/src/Model/DocumentationNode.kt @@ -1,6 +1,6 @@ package org.jetbrains.dokka -import java.util.LinkedHashSet +import java.util.* public open class DocumentationNode(val name: String, content: Content, @@ -19,6 +19,8 @@ public open class DocumentationNode(val name: String, get() = references(DocumentationReference.Kind.Detail).map { it.to } public val members: List<DocumentationNode> get() = references(DocumentationReference.Kind.Member).map { it.to } + public val inheritedMembers: List<DocumentationNode> + get() = references(DocumentationReference.Kind.InheritedMember).map { it.to } public val extensions: List<DocumentationNode> get() = references(DocumentationReference.Kind.Extension).map { it.to } public val inheritors: List<DocumentationNode> @@ -27,6 +29,8 @@ public open class DocumentationNode(val name: String, get() = references(DocumentationReference.Kind.Override).map { it.to } public val links: List<DocumentationNode> get() = references(DocumentationReference.Kind.Link).map { it.to } + public val hiddenLinks: List<DocumentationNode> + get() = references(DocumentationReference.Kind.HiddenLink).map { it.to } public val annotations: List<DocumentationNode> get() = references(DocumentationReference.Kind.Annotation).map { it.to } public val deprecation: DocumentationNode? @@ -50,6 +54,7 @@ public open class DocumentationNode(val name: String, public fun details(kind: DocumentationNode.Kind): List<DocumentationNode> = details.filter { it.kind == kind } public fun members(kind: DocumentationNode.Kind): List<DocumentationNode> = members.filter { it.kind == kind } + public fun inheritedMembers(kind: DocumentationNode.Kind): List<DocumentationNode> = inheritedMembers.filter { it.kind == kind } public fun links(kind: DocumentationNode.Kind): List<DocumentationNode> = links.filter { it.kind == kind } public fun detail(kind: DocumentationNode.Kind): DocumentationNode = details.filter { it.kind == kind }.single() @@ -112,6 +117,10 @@ public open class DocumentationNode(val name: String, } +public class DocumentationModule(name: String, content: Content = Content.Empty) + : DocumentationNode(name, content, DocumentationNode.Kind.Module) { +} + val DocumentationNode.path: List<DocumentationNode> get() { val parent = owner ?: return listOf(this) @@ -137,6 +146,7 @@ fun DocumentationNode.append(child: DocumentationNode, kind: DocumentationRefere DocumentationReference.Kind.Detail -> child.addReferenceTo(this, DocumentationReference.Kind.Owner) DocumentationReference.Kind.Member -> child.addReferenceTo(this, DocumentationReference.Kind.Owner) DocumentationReference.Kind.Owner -> child.addReferenceTo(this, DocumentationReference.Kind.Member) + else -> { /* Do not add any links back for other types */ } } } @@ -145,3 +155,5 @@ fun DocumentationNode.appendTextNode(text: String, refKind: DocumentationReference.Kind = DocumentationReference.Kind.Detail) { append(DocumentationNode(text, Content.Empty, kind), refKind) } + +fun DocumentationNode.qualifiedName() = path.drop(1).map { it.name }.filter { it.length > 0 }.joinToString(".") |