aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/pages
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /core/src/main/kotlin/pages
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'core/src/main/kotlin/pages')
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt436
-rw-r--r--core/src/main/kotlin/pages/PageNodes.kt200
-rw-r--r--core/src/main/kotlin/pages/Pages.kt15
-rw-r--r--core/src/main/kotlin/pages/RendererSpecificPage.kt52
-rw-r--r--core/src/main/kotlin/pages/contentNodeProperties.kt37
-rw-r--r--core/src/main/kotlin/pages/utils.kt63
6 files changed, 0 insertions, 803 deletions
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
deleted file mode 100644
index 96f43205..00000000
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.DisplaySourceSet
-import org.jetbrains.dokka.model.WithChildren
-import org.jetbrains.dokka.model.properties.PropertyContainer
-import org.jetbrains.dokka.model.properties.WithExtraProperties
-
-public data class DCI(val dri: Set<DRI>, val kind: Kind) {
- override fun toString(): String = "$dri[$kind]"
-}
-
-public interface ContentNode : WithExtraProperties<ContentNode>, WithChildren<ContentNode> {
- public val dci: DCI
- public val sourceSets: Set<DisplaySourceSet>
- public val style: Set<Style>
-
- public fun hasAnyContent(): Boolean
-
- public fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentNode
-
- override val children: List<ContentNode>
- get() = emptyList()
-}
-
-/** Simple text */
-public data class ContentText(
- val text: String,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style> = emptySet(),
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentNode {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentText = copy(extra = newExtras)
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentText = copy(sourceSets = sourceSets)
- override fun hasAnyContent(): Boolean = text.isNotBlank()
-}
-
-public data class ContentBreakLine(
- override val sourceSets: Set<DisplaySourceSet>,
- override val dci: DCI = DCI(emptySet(), ContentKind.Empty),
- override val style: Set<Style> = emptySet(),
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentNode {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentBreakLine = copy(extra = newExtras)
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentBreakLine = copy(sourceSets = sourceSets)
- override fun hasAnyContent(): Boolean = true
-}
-
-/** Headers */
-public data class ContentHeader(
- override val children: List<ContentNode>,
- val level: Int,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- public constructor(level: Int, c: ContentComposite) : this(c.children, level, c.dci, c.sourceSets, c.style, c.extra)
-
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentHeader = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentHeader =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentHeader =
- copy(sourceSets = sourceSets)
-}
-
-public interface ContentCode : ContentComposite
-
-/** Code blocks */
-public data class ContentCodeBlock(
- override val children: List<ContentNode>,
- val language: String,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentCode {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCodeBlock = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentCodeBlock =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentCodeBlock =
- copy(sourceSets = sourceSets)
-
-}
-
-public data class ContentCodeInline(
- override val children: List<ContentNode>,
- val language: String,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentCode {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentCodeInline = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentCodeInline =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentCodeInline =
- copy(sourceSets = sourceSets)
-
-}
-
-/** Union type replacement */
-public interface ContentLink : ContentComposite
-
-/** All links to classes, packages, etc. that have te be resolved */
-public data class ContentDRILink(
- override val children: List<ContentNode>,
- val address: DRI,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style> = emptySet(),
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentLink {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDRILink = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentDRILink =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDRILink =
- copy(sourceSets = sourceSets)
-
-}
-
-/** All links that do not need to be resolved */
-public data class ContentResolvedLink(
- override val children: List<ContentNode>,
- val address: String,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style> = emptySet(),
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentLink {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentResolvedLink =
- copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentResolvedLink =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentResolvedLink =
- copy(sourceSets = sourceSets)
-}
-
-/** Embedded resources like images */
-public data class ContentEmbeddedResource(
- override val children: List<ContentNode> = emptyList(),
- val address: String,
- val altText: String?,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style> = emptySet(),
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentLink {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentEmbeddedResource =
- copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentEmbeddedResource =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentEmbeddedResource =
- copy(sourceSets = sourceSets)
-}
-
-/** Logical grouping of [ContentNode]s */
-public interface ContentComposite : ContentNode {
- override val children: List<ContentNode> // overwrite to make it abstract once again
-
- override val sourceSets: Set<DisplaySourceSet> get() = children.flatMap { it.sourceSets }.toSet()
-
- public fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentComposite
-
- override fun hasAnyContent(): Boolean = children.any { it.hasAnyContent() }
-}
-
-/** Tables */
-public data class ContentTable(
- val header: List<ContentGroup>,
- val caption: ContentGroup? = null,
- override val children: List<ContentGroup>,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentTable = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentTable =
- copy(children = children.map(transformer).map { it as ContentGroup })
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentTable =
- copy(sourceSets = sourceSets)
-
-}
-
-/** Lists */
-public data class ContentList(
- override val children: List<ContentNode>,
- val ordered: Boolean,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentList = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentList =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentList =
- copy(sourceSets = sourceSets)
-}
-
-/** Default group, eg. for blocks of Functions, Properties, etc. **/
-public data class ContentGroup(
- override val children: List<ContentNode>,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentGroup = copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentGroup =
- copy(children = children.map(transformer))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentGroup =
- copy(sourceSets = sourceSets)
-}
-
-/**
- * @property groupID is used for finding and copying [ContentDivergentInstance]s when merging [ContentPage]s
- */
-public data class ContentDivergentGroup(
- override val children: List<ContentDivergentInstance>,
- override val dci: DCI,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode>,
- val groupID: GroupID,
- val implicitlySourceSetHinted: Boolean = true
-) : ContentComposite {
- public data class GroupID(val name: String)
-
- override val sourceSets: Set<DisplaySourceSet>
- get() = children.flatMap { it.sourceSets }.distinct().toSet()
-
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDivergentGroup =
- copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentDivergentGroup =
- copy(children = children.map(transformer).map { it as ContentDivergentInstance })
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDivergentGroup = this
-}
-
-/** Instance of a divergent content */
-public data class ContentDivergentInstance(
- val before: ContentNode?,
- val divergent: ContentNode,
- val after: ContentNode?,
- override val dci: DCI,
- override val sourceSets: Set<DisplaySourceSet>,
- override val style: Set<Style>,
- override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
-) : ContentComposite {
- override val children: List<ContentNode>
- get() = listOfNotNull(before, divergent, after)
-
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDivergentInstance =
- copy(extra = newExtras)
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentDivergentInstance =
- copy(
- before = before?.let(transformer),
- divergent = divergent.let(transformer),
- after = after?.let(transformer)
- )
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDivergentInstance =
- copy(sourceSets = sourceSets)
-
-}
-
-public data class PlatformHintedContent(
- val inner: ContentNode,
- override val sourceSets: Set<DisplaySourceSet>
-) : ContentComposite {
- override val children: List<ContentNode> = listOf(inner)
-
- override val dci: DCI
- get() = inner.dci
-
- override val extra: PropertyContainer<ContentNode>
- get() = inner.extra
-
- override val style: Set<Style>
- get() = inner.style
-
- override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode =
- throw UnsupportedOperationException("This method should not be called on this PlatformHintedContent")
-
- override fun transformChildren(transformer: (ContentNode) -> ContentNode): PlatformHintedContent =
- copy(inner = transformer(inner))
-
- override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): PlatformHintedContent =
- copy(sourceSets = sourceSets)
-
-}
-
-public interface Style
-public interface Kind
-
-/**
- * [ContentKind] represents a grouping of content of one kind that can can be rendered
- * as part of a composite page (one tab/block within a class's page, for instance).
- */
-public enum class ContentKind : Kind {
-
- /**
- * Marks all sorts of signatures. Can contain sub-kinds marked as [SymbolContentKind]
- *
- * Some examples:
- * - primary constructor: `data class CoroutineName(name: String) : AbstractCoroutineContextElement`
- * - constructor: `fun CoroutineName(name: String)`
- * - function: `open override fun toString(): String`
- * - property: `val name: String`
- */
- Symbol,
-
- Comment, Constructors, Functions, Parameters, Properties, Classlikes, Packages, Sample, Main, BriefComment,
- Empty, Source, TypeAliases, Cover, Inheritors, SourceSetDependentHint, Extensions, Annotations,
-
- /**
- * Deprecation details block with related information such as message/replaceWith/level.
- */
- Deprecation;
-
- public companion object {
- private val platformTagged =
- setOf(
- Constructors,
- Functions,
- Properties,
- Classlikes,
- Packages,
- Source,
- TypeAliases,
- Inheritors,
- Extensions
- )
-
- public fun shouldBePlatformTagged(kind: Kind): Boolean = kind in platformTagged
- }
-}
-
-/**
- * Content kind for [ContentKind.Symbol] content, which is essentially about signatures
- */
-public enum class SymbolContentKind : Kind {
- /**
- * Marks constructor/function parameters, everything in-between parentheses.
- *
- * For function `fun foo(bar: String, baz: Int, qux: Boolean)`,
- * the parameters would be the whole of `bar: String, baz: Int, qux: Boolean`
- */
- Parameters,
-
- /**
- * Marks a single parameter in a function. Most likely to be a child of [Parameters].
- *
- * In function `fun foo(bar: String, baz: Int, qux: Boolean)` there would be 3 [Parameter] instances:
- * - `bar: String, `
- * - `baz: Int, `
- * - `qux: Boolean`
- */
- Parameter,
-}
-
-public enum class TokenStyle : Style {
- Keyword, Punctuation, Function, Operator, Annotation, Number, String, Boolean, Constant
-}
-
-public enum class TextStyle : Style {
- Bold, Italic, Strong, Strikethrough, Paragraph,
- Block, Span, Monospace, Indented, Cover, UnderCoverText, BreakableAfter, Breakable, InlineComment, Quotation,
- FloatingRight, Var, Underlined
-}
-
-public enum class ContentStyle : Style {
- RowTitle,
- /**
- * The style is used only for HTML. It is applied only for [ContentGroup].
- * Creating and rendering tabs is a part of a renderer.
- */
- TabbedContent,
-
- WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption,
- Wrapped, Indented, KDocTag, Footnote
-}
-
-public enum class ListStyle : Style {
- /**
- * Represents a list of groups of [DescriptionTerm] and [DescriptionDetails].
- * Common uses for this element are to implement a glossary or to display
- * metadata (a list of key-value pairs). Formatting example: see `<dl>` html tag.
- */
- DescriptionList,
-
- /**
- * If used within [DescriptionList] context, specifies a term in a description
- * or definition list, usually followed by [DescriptionDetails] for one or more
- * terms. Formatting example: see `<dt>` html tag
- */
- DescriptionTerm,
-
- /**
- * If used within [DescriptionList] context, provides the definition or other
- * related text associated with [DescriptionTerm]. Formatting example: see `<dd>` html tag
- */
- DescriptionDetails
-}
-
-public object CommentTable : Style
-
-public object MultimoduleTable : Style
-
-public fun ContentNode.hasStyle(style: Style): Boolean = this.style.contains(style)
diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt
deleted file mode 100644
index cfaf2347..00000000
--- a/core/src/main/kotlin/pages/PageNodes.kt
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.model.WithChildren
-import java.util.*
-
-public interface PageNode : WithChildren<PageNode> {
- public val name: String
- override val children: List<PageNode>
-
- public fun modified(
- name: String = this.name,
- children: List<PageNode> = this.children
- ): PageNode
-}
-
-public interface ContentPage : PageNode {
- public val content: ContentNode
- public val dri: Set<DRI>
- public val embeddedResources: List<String>
-
- @Deprecated("Deprecated. Remove its usages from your code.",
- ReplaceWith("this.documentables.firstOrNull()")
- )
- public val documentable: Documentable?
- get() = if (this is WithDocumentables) this.documentables.firstOrNull() else null
-
- public fun modified(
- name: String = this.name,
- content: ContentNode = this.content,
- dri: Set<DRI> = this.dri,
- embeddedResources: List<String> = this.embeddedResources,
- children: List<PageNode> = this.children
- ): ContentPage
-}
-
-public interface WithDocumentables {
- public val documentables: List<Documentable>
-}
-
-public abstract class RootPageNode(
- public val forceTopLevelName: Boolean = false
-) : PageNode {
- public val parentMap: Map<PageNode, PageNode> by lazy {
- IdentityHashMap<PageNode, PageNode>().apply {
- fun process(parent: PageNode) {
- parent.children.forEach { child ->
- put(child, parent)
- process(child)
- }
- }
- process(this@RootPageNode)
- }
- }
-
- public fun transformPageNodeTree(operation: (PageNode) -> PageNode): RootPageNode =
- this.transformNode(operation) as RootPageNode
-
- public fun transformContentPagesTree(operation: (ContentPage) -> ContentPage): RootPageNode = transformPageNodeTree {
- if (it is ContentPage) operation(it) else it
- }
-
- private fun PageNode.transformNode(operation: (PageNode) -> PageNode): PageNode =
- operation(this).let { newNode ->
- newNode.modified(children = newNode.children.map { it.transformNode(operation) })
- }
-
- abstract override fun modified(
- name: String,
- children: List<PageNode>
- ): RootPageNode
-}
-
-public class ModulePageNode(
- override val name: String,
- override val content: ContentNode,
- override val documentables: List<Documentable> = listOf(),
- override val children: List<PageNode>,
- override val embeddedResources: List<String> = listOf()
-) : RootPageNode(), ModulePage {
- override val dri: Set<DRI> = setOf(DRI.topLevel)
-
- override fun modified(name: String, children: List<PageNode>): ModulePageNode =
- modified(name = name, content = this.content, dri = dri, children = children)
-
- override fun modified(
- name: String,
- content: ContentNode,
- dri: Set<DRI>,
- embeddedResources: List<String>,
- children: List<PageNode>
- ): ModulePageNode =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else ModulePageNode(name, content, documentables, children, embeddedResources)
-}
-
-public class PackagePageNode(
- override val name: String,
- override val content: ContentNode,
- override val dri: Set<DRI>,
- override val documentables: List<Documentable> = listOf(),
- override val children: List<PageNode>,
- override val embeddedResources: List<String> = listOf()
-) : PackagePage {
-
- init {
- require(name.isNotBlank()) { "PackagePageNode.name cannot be blank" }
- }
-
- override fun modified(name: String, children: List<PageNode>): PackagePageNode =
- modified(name = name, content = this.content, children = children)
-
- override fun modified(
- name: String,
- content: ContentNode,
- dri: Set<DRI>,
- embeddedResources: List<String>,
- children: List<PageNode>
- ): PackagePageNode =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else PackagePageNode(name, content, dri, documentables, children, embeddedResources)
-}
-
-public class ClasslikePageNode(
- override val name: String,
- override val content: ContentNode,
- override val dri: Set<DRI>,
- override val documentables: List<Documentable> = listOf(),
- override val children: List<PageNode>,
- override val embeddedResources: List<String> = listOf()
-) : ClasslikePage {
- override fun modified(name: String, children: List<PageNode>): ClasslikePageNode =
- modified(name = name, content = this.content, children = children)
-
- override fun modified(
- name: String,
- content: ContentNode,
- dri: Set<DRI>,
- embeddedResources: List<String>,
- children: List<PageNode>
- ): ClasslikePageNode =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else ClasslikePageNode(name, content, dri, documentables, children, embeddedResources)
-}
-
-public class MemberPageNode(
- override val name: String,
- override val content: ContentNode,
- override val dri: Set<DRI>,
- override val documentables: List<Documentable> = listOf(),
- override val children: List<PageNode> = emptyList(),
- override val embeddedResources: List<String> = listOf()
-) : MemberPage {
- override fun modified(name: String, children: List<PageNode>): MemberPageNode =
- modified(name = name, content = this.content, children = children)
-
- override fun modified(
- name: String,
- content: ContentNode,
- dri: Set<DRI>,
- embeddedResources: List<String>,
- children: List<PageNode>
- ): MemberPageNode =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else MemberPageNode(name, content, dri, documentables, children, embeddedResources)
-}
-
-
-public class MultimoduleRootPageNode(
- override val dri: Set<DRI>,
- override val content: ContentNode,
- override val embeddedResources: List<String> = emptyList()
-) : RootPageNode(forceTopLevelName = true), MultimoduleRootPage {
- override val name: String = "All modules"
-
- override val children: List<PageNode> = emptyList()
-
- override fun modified(name: String, children: List<PageNode>): RootPageNode =
- MultimoduleRootPageNode(dri, content, embeddedResources)
-
- override fun modified(
- name: String,
- content: ContentNode,
- dri: Set<DRI>,
- embeddedResources: List<String>,
- children: List<PageNode>
- ): ContentPage =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else MultimoduleRootPageNode(dri, content, embeddedResources)
-}
-
-public inline fun <reified T : PageNode> PageNode.children(): List<T> = children.filterIsInstance<T>()
-
-private infix fun <T> List<T>.shallowEq(other: List<T>) =
- this === other || (this.size == other.size && (this zip other).all { (a, b) -> a === b })
diff --git a/core/src/main/kotlin/pages/Pages.kt b/core/src/main/kotlin/pages/Pages.kt
deleted file mode 100644
index 0bf225c9..00000000
--- a/core/src/main/kotlin/pages/Pages.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-public interface MultimoduleRootPage : ContentPage
-
-public interface ModulePage : ContentPage, WithDocumentables
-
-public interface PackagePage : ContentPage, WithDocumentables
-
-public interface ClasslikePage : ContentPage, WithDocumentables
-
-public interface MemberPage : ContentPage, WithDocumentables
diff --git a/core/src/main/kotlin/pages/RendererSpecificPage.kt b/core/src/main/kotlin/pages/RendererSpecificPage.kt
deleted file mode 100644
index 701886b7..00000000
--- a/core/src/main/kotlin/pages/RendererSpecificPage.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.DisplaySourceSet
-import org.jetbrains.dokka.renderers.Renderer
-import kotlin.reflect.KClass
-
-public fun interface DriResolver: (DRI, Set<DisplaySourceSet>) -> String?
-public fun interface PageResolver: (PageNode, PageNode?) -> String?
-
-public interface RendererSpecificPage : PageNode {
- public val strategy: RenderingStrategy
-}
-
-public class RendererSpecificRootPage(
- override val name: String,
- override val children: List<PageNode>,
- override val strategy: RenderingStrategy
-) : RootPageNode(), RendererSpecificPage {
- override fun modified(name: String, children: List<PageNode>): RendererSpecificRootPage =
- RendererSpecificRootPage(name, children, strategy)
-}
-
-public class RendererSpecificResourcePage(
- override val name: String,
- override val children: List<PageNode>,
- override val strategy: RenderingStrategy
-): RendererSpecificPage {
- override fun modified(name: String, children: List<PageNode>): RendererSpecificResourcePage =
- RendererSpecificResourcePage(name, children, strategy)
-}
-
-public sealed class RenderingStrategy {
- public class Callback(public val instructions: Renderer.(PageNode) -> String): RenderingStrategy()
- public data class Copy(val from: String) : RenderingStrategy()
- public data class Write(val text: String) : RenderingStrategy()
- public data class DriLocationResolvableWrite(val contentToResolve: (DriResolver) -> String) : RenderingStrategy()
- public data class PageLocationResolvableWrite(val contentToResolve: (PageResolver) -> String) : RenderingStrategy()
- public object DoNothing : RenderingStrategy()
-
- public companion object {
- public inline operator fun <reified T: Renderer> invoke(crossinline instructions: T.(PageNode) -> String): RenderingStrategy {
- return Callback { if (this is T) instructions(it) else throw WrongRendererTypeException(T::class) }
- }
- }
-}
-
-public data class WrongRendererTypeException(val expectedType: KClass<*>): Exception()
diff --git a/core/src/main/kotlin/pages/contentNodeProperties.kt b/core/src/main/kotlin/pages/contentNodeProperties.kt
deleted file mode 100644
index 64f19572..00000000
--- a/core/src/main/kotlin/pages/contentNodeProperties.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-import org.jetbrains.dokka.model.properties.ExtraProperty
-
-public class SimpleAttr(
- public val extraKey: String,
- public val extraValue: String
-) : ExtraProperty<ContentNode> {
- public data class SimpleAttrKey(val key: String) : ExtraProperty.Key<ContentNode, SimpleAttr>
- override val key: ExtraProperty.Key<ContentNode, SimpleAttr> = SimpleAttrKey(extraKey)
-
-}
-
-public enum class BasicTabbedContentType : TabbedContentType {
- TYPE, CONSTRUCTOR, FUNCTION, PROPERTY, ENTRY, EXTENSION_PROPERTY, EXTENSION_FUNCTION
-}
-
-/**
- * It is used only to mark content for tabs in HTML format
- */
-public interface TabbedContentType
-
-/**
- * @see TabbedContentType
- */
-public class TabbedContentTypeExtra(public val value: TabbedContentType) : ExtraProperty<ContentNode> {
- public companion object : ExtraProperty.Key<ContentNode, TabbedContentTypeExtra>
- override val key: ExtraProperty.Key<ContentNode, TabbedContentTypeExtra> = TabbedContentTypeExtra
-}
-
-public object HtmlContent : ExtraProperty<ContentNode>, ExtraProperty.Key<ContentNode, HtmlContent> {
- override val key: ExtraProperty.Key<ContentNode, *> = this
-}
diff --git a/core/src/main/kotlin/pages/utils.kt b/core/src/main/kotlin/pages/utils.kt
deleted file mode 100644
index 6c416e24..00000000
--- a/core/src/main/kotlin/pages/utils.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.pages
-
-import kotlin.reflect.KClass
-
-public inline fun <reified T : ContentNode, R : ContentNode> R.mapTransform(noinline operation: (T) -> T): R =
- mapTransform(T::class, operation)
-
-public inline fun <reified T : ContentNode, R : ContentNode> R.recursiveMapTransform(noinline operation: (T) -> T): R =
- recursiveMapTransform(T::class, operation)
-
-@PublishedApi
-@Suppress("UNCHECKED_CAST")
-internal fun <T : ContentNode, R : ContentNode> R.mapTransform(type: KClass<T>, operation: (T) -> T): R {
- if (this::class == type) {
- return operation(this as T) as R
- }
- val new = when (this) {
- is ContentGroup -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentHeader -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentCodeBlock -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentCodeInline -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentTable -> copy(header = header.map { it.recursiveMapTransform(type, operation) }, children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentList -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentDivergentGroup -> copy(children = children.map { it.mapTransform(type, operation) })
- is ContentDivergentInstance -> copy(
- before = before?.mapTransform(type, operation),
- divergent = divergent.mapTransform(type, operation),
- after = after?.mapTransform(type, operation)
- )
- is PlatformHintedContent -> copy(inner = inner.mapTransform(type, operation))
- else -> this
- }
- return new as R
-}
-
-@PublishedApi
-@Suppress("UNCHECKED_CAST")
-internal fun <T : ContentNode, R : ContentNode> R.recursiveMapTransform(type: KClass<T>, operation: (T) -> T): R {
- val new = when (this) {
- is ContentGroup -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentHeader -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentCodeBlock -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentCodeInline -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentTable -> copy(header = header.map { it.recursiveMapTransform(type, operation) }, children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentList -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentDivergentGroup -> copy(children = children.map { it.recursiveMapTransform(type, operation) })
- is ContentDivergentInstance -> copy(
- before = before?.recursiveMapTransform(type, operation),
- divergent = divergent.recursiveMapTransform(type, operation),
- after = after?.recursiveMapTransform(type, operation)
- )
- is PlatformHintedContent -> copy(inner = inner.recursiveMapTransform(type, operation))
- else -> this
- }
- if (new::class == type) {
- return operation(new as T) as R
- }
- return new as R
-}