diff options
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r-- | core/src/main/kotlin/pages/PageNodes.kt | 29 | ||||
-rw-r--r-- | core/src/main/kotlin/pages/Pages.kt | 8 |
2 files changed, 22 insertions, 15 deletions
diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt index 9fc4d6e8..75e27dcc 100644 --- a/core/src/main/kotlin/pages/PageNodes.kt +++ b/core/src/main/kotlin/pages/PageNodes.kt @@ -18,9 +18,14 @@ interface PageNode : WithChildren<PageNode> { interface ContentPage : PageNode { val content: ContentNode val dri: Set<DRI> - val documentable: Documentable? val embeddedResources: List<String> + @Deprecated("Deprecated. Remove its usages from your code.", + ReplaceWith("documentables.firstOrNull()") + ) + val documentable: Documentable? + get() = if (this is WithDocumentables) this.documentables.firstOrNull() else null + fun modified( name: String = this.name, content: ContentNode = this.content, @@ -30,6 +35,10 @@ interface ContentPage : PageNode { ): ContentPage } +interface WithDocumentables { + val documentables: List<Documentable> +} + abstract class RootPageNode(val forceTopLevelName: Boolean = false) : PageNode { val parentMap: Map<PageNode, PageNode> by lazy { IdentityHashMap<PageNode, PageNode>().apply { @@ -64,7 +73,7 @@ abstract class RootPageNode(val forceTopLevelName: Boolean = false) : PageNode { class ModulePageNode( override val name: String, override val content: ContentNode, - override val documentable: Documentable?, + override val documentables: List<Documentable> = listOf(), override val children: List<PageNode>, override val embeddedResources: List<String> = listOf() ) : RootPageNode(), ModulePage { @@ -81,14 +90,14 @@ class ModulePageNode( children: List<PageNode> ): ModulePageNode = if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this - else ModulePageNode(name, content, documentable, children, embeddedResources) + else ModulePageNode(name, content, documentables, children, embeddedResources) } class PackagePageNode( override val name: String, override val content: ContentNode, override val dri: Set<DRI>, - override val documentable: Documentable?, + override val documentables: List<Documentable> = listOf(), override val children: List<PageNode>, override val embeddedResources: List<String> = listOf() ) : PackagePage { @@ -108,14 +117,14 @@ class PackagePageNode( children: List<PageNode> ): PackagePageNode = if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this - else PackagePageNode(name, content, dri, documentable, children, embeddedResources) + else PackagePageNode(name, content, dri, documentables, children, embeddedResources) } class ClasslikePageNode( override val name: String, override val content: ContentNode, override val dri: Set<DRI>, - override val documentable: Documentable?, + override val documentables: List<Documentable> = listOf(), override val children: List<PageNode>, override val embeddedResources: List<String> = listOf() ) : ClasslikePage { @@ -130,14 +139,14 @@ class ClasslikePageNode( children: List<PageNode> ): ClasslikePageNode = if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this - else ClasslikePageNode(name, content, dri, documentable, children, embeddedResources) + else ClasslikePageNode(name, content, dri, documentables, children, embeddedResources) } class MemberPageNode( override val name: String, override val content: ContentNode, override val dri: Set<DRI>, - override val documentable: Documentable?, + override val documentables: List<Documentable> = listOf(), override val children: List<PageNode> = emptyList(), override val embeddedResources: List<String> = listOf() ) : MemberPage { @@ -152,7 +161,7 @@ class MemberPageNode( children: List<PageNode> ): MemberPageNode = if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this - else MemberPageNode(name, content, dri, documentable, children, embeddedResources) + else MemberPageNode(name, content, dri, documentables, children, embeddedResources) } @@ -165,8 +174,6 @@ class MultimoduleRootPageNode( override val children: List<PageNode> = emptyList() - override val documentable: Documentable? = null - override fun modified(name: String, children: List<PageNode>): RootPageNode = MultimoduleRootPageNode(dri, content, embeddedResources) diff --git a/core/src/main/kotlin/pages/Pages.kt b/core/src/main/kotlin/pages/Pages.kt index b65e72d6..90ae09e8 100644 --- a/core/src/main/kotlin/pages/Pages.kt +++ b/core/src/main/kotlin/pages/Pages.kt @@ -2,10 +2,10 @@ package org.jetbrains.dokka.pages interface MultimoduleRootPage : ContentPage -interface ModulePage : ContentPage +interface ModulePage : ContentPage, WithDocumentables -interface PackagePage : ContentPage +interface PackagePage : ContentPage, WithDocumentables -interface ClasslikePage : ContentPage +interface ClasslikePage : ContentPage, WithDocumentables -interface MemberPage : ContentPage
\ No newline at end of file +interface MemberPage : ContentPage, WithDocumentables
\ No newline at end of file |