aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/pages/PageNodes.kt10
-rw-r--r--core/src/main/kotlin/pages/Pages.kt11
-rw-r--r--plugins/base/src/main/kotlin/renderers/PackageListService.kt2
-rw-r--r--plugins/base/src/main/kotlin/renderers/preprocessors.kt6
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt10
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt6
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt8
7 files changed, 35 insertions, 18 deletions
diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt
index d49f9911..176c0993 100644
--- a/core/src/main/kotlin/pages/PageNodes.kt
+++ b/core/src/main/kotlin/pages/PageNodes.kt
@@ -67,7 +67,7 @@ class ModulePageNode(
override val documentable: Documentable?,
override val children: List<PageNode>,
override val embeddedResources: List<String> = listOf()
-) : RootPageNode(), ContentPage {
+) : RootPageNode(), ModulePage {
override val dri: Set<DRI> = setOf(DRI.topLevel)
override fun modified(name: String, children: List<PageNode>): ModulePageNode =
@@ -91,7 +91,7 @@ class PackagePageNode(
override val documentable: Documentable?,
override val children: List<PageNode>,
override val embeddedResources: List<String> = listOf()
-) : ContentPage {
+) : PackagePage {
override fun modified(name: String, children: List<PageNode>): PackagePageNode =
modified(name = name, content = this.content, children = children)
@@ -113,7 +113,7 @@ class ClasslikePageNode(
override val documentable: Documentable?,
override val children: List<PageNode>,
override val embeddedResources: List<String> = listOf()
-) : ContentPage {
+) : ClasslikePage {
override fun modified(name: String, children: List<PageNode>): ClasslikePageNode =
modified(name = name, content = this.content, children = children)
@@ -135,7 +135,7 @@ class MemberPageNode(
override val documentable: Documentable?,
override val children: List<PageNode> = emptyList(),
override val embeddedResources: List<String> = listOf()
-) : ContentPage {
+) : MemberPage {
override fun modified(name: String, children: List<PageNode>): MemberPageNode =
modified(name = name, content = this.content, children = children) as MemberPageNode
@@ -156,7 +156,7 @@ class MultimoduleRootPageNode(
override val dri: Set<DRI>,
override val content: ContentNode,
override val embeddedResources: List<String> = emptyList()
-) : RootPageNode(), ContentPage {
+) : RootPageNode(), MultimoduleRootPage {
override val children: List<PageNode> = emptyList()
diff --git a/core/src/main/kotlin/pages/Pages.kt b/core/src/main/kotlin/pages/Pages.kt
new file mode 100644
index 00000000..b65e72d6
--- /dev/null
+++ b/core/src/main/kotlin/pages/Pages.kt
@@ -0,0 +1,11 @@
+package org.jetbrains.dokka.pages
+
+interface MultimoduleRootPage : ContentPage
+
+interface ModulePage : ContentPage
+
+interface PackagePage : ContentPage
+
+interface ClasslikePage : ContentPage
+
+interface MemberPage : ContentPage \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/renderers/PackageListService.kt b/plugins/base/src/main/kotlin/renderers/PackageListService.kt
index 44769d9e..3d631f5c 100644
--- a/plugins/base/src/main/kotlin/renderers/PackageListService.kt
+++ b/plugins/base/src/main/kotlin/renderers/PackageListService.kt
@@ -21,7 +21,7 @@ class PackageListService(val context: DokkaContext) {
fun visit(node: PageNode, parentDris: Set<DRI>) {
- if (node is PackagePageNode) {
+ if (node is PackagePage) {
node.name
.takeUnless { name -> name.startsWith("[") && name.endsWith("]") } // Do not include the package name for declarations without one
?.let { packages.add(it) }
diff --git a/plugins/base/src/main/kotlin/renderers/preprocessors.kt b/plugins/base/src/main/kotlin/renderers/preprocessors.kt
index b07db2bd..42d0d3c4 100644
--- a/plugins/base/src/main/kotlin/renderers/preprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/preprocessors.kt
@@ -11,17 +11,17 @@ object RootCreator : PageTransformer {
}
-class PackageListCreator(val context: DokkaContext, val format: LinkFormat) : PageTransformer {
+class PackageListCreator(val context: DokkaContext, val format: LinkFormat, val fileName: String = "package-list") : PageTransformer {
override fun invoke(input: RootPageNode) =
input.modified(children = input.children.map {
- it.takeUnless { it is ModulePageNode }
+ it.takeUnless { it is ModulePage }
?: it.modified(children = it.children + packageList(input)) // TODO packageList should take module as an input
})
private fun packageList(pageNode: RootPageNode) =
RendererSpecificResourcePage(
- "${pageNode.name}/package-list",
+ "${pageNode.name}/${fileName}",
emptyList(),
RenderingStrategy.Write(PackageListService(context).formatPackageList(pageNode, format.formatName, format.linkExtension))
)
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
index cf45ef75..eb0b7b97 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
@@ -9,6 +9,7 @@ import org.jetbrains.dokka.base.renderers.PackageListCreator
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat
import org.jetbrains.dokka.javadoc.pages.AllClassesPageInstaller
+import org.jetbrains.dokka.javadoc.pages.IndexGenerator
import org.jetbrains.dokka.javadoc.pages.ResourcesInstaller
import org.jetbrains.dokka.javadoc.pages.TreeViewInstaller
import org.jetbrains.dokka.kotlinAsJava.KotlinAsJavaPlugin
@@ -63,8 +64,9 @@ class JavadocPlugin : DokkaPlugin() {
val packageListCreator by extending {
javadocPreprocessors providing {
PackageListCreator(
- it,
- RecognizedLinkFormat.DokkaJavadoc
+ context = it,
+ format = RecognizedLinkFormat.DokkaJavadoc,
+ fileName = "element-list"
)
} order { after(rootCreator) }
}
@@ -80,5 +82,9 @@ class JavadocPlugin : DokkaPlugin() {
val allClassessPageInstaller by extending {
javadocPreprocessors with AllClassesPageInstaller order { before(rootCreator) }
}
+
+ val indexGenerator by extending {
+ javadocPreprocessors with IndexGenerator order { before(rootCreator) }
+ }
}
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
index 7bc6d6d8..31d879a2 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
@@ -38,7 +38,7 @@ class JavadocModulePageNode(
override val dri: Set<DRI>
) :
RootPageNode(),
- JavadocPageNode {
+ JavadocPageNode, ModulePage {
override val documentable: Documentable? = null
override val embeddedResources: List<String> = emptyList()
@@ -62,7 +62,7 @@ class JavadocPackagePageNode(
override val documentable: Documentable? = null,
override val children: List<PageNode> = emptyList(),
override val embeddedResources: List<String> = listOf()
-) : JavadocPageNode, WithIndexables, IndexableJavadocNode {
+) : JavadocPageNode, WithIndexables, IndexableJavadocNode, PackagePage {
override fun getAllIndexables(): List<IndexableJavadocNode> =
children.filterIsInstance<IndexableJavadocNode>().flatMap {
@@ -172,7 +172,7 @@ class JavadocClasslikePageNode(
override val children: List<PageNode> = emptyList(),
override val embeddedResources: List<String> = listOf(),
override val extra: PropertyContainer<DClasslike> = PropertyContainer.empty(),
-) : JavadocPageNode, WithJavadocExtra<DClasslike>, IndexableJavadocNode, WithIndexables, WithBrief {
+) : JavadocPageNode, WithJavadocExtra<DClasslike>, IndexableJavadocNode, WithIndexables, WithBrief, ClasslikePage {
override fun getAllIndexables(): List<IndexableJavadocNode> =
methods + entries + classlikes.map { it.getAllIndexables() }.flatten() + this
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
index f31b5793..b3b21909 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
@@ -26,13 +26,13 @@ internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() {
){
val contents = writerPlugin.writer.contents
val expected = """
- ${'$'}dokka.format:dokkaJavadoc
+ ${'$'}dokka.format:javadoc-v1
${'$'}dokka.linkExtension:html
package0
package1
""".trimIndent()
- assertEquals(expected, contents["/package-list"]?.trimIndent())
+ assertEquals(expected, contents["/element-list"]?.trimIndent())
}
}
@@ -61,14 +61,14 @@ internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() {
){
val contents = writerPlugin.writer.contents
val expected = """
- ${'$'}dokka.format:dokkaJavadoc
+ ${'$'}dokka.format:javadoc-v1
${'$'}dokka.linkExtension:html
package0
package0.package0Inner
package1.package1Inner.package1InnerInner
""".trimIndent()
- assertEquals(expected, contents["/package-list"]?.trimIndent())
+ assertEquals(expected, contents["/element-list"]?.trimIndent())
}
}
} \ No newline at end of file