diff options
3 files changed, 14 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/preprocessors.kt b/plugins/base/src/main/kotlin/renderers/preprocessors.kt index 42d0d3c4..2640398c 100644 --- a/plugins/base/src/main/kotlin/renderers/preprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/preprocessors.kt @@ -11,7 +11,7 @@ object RootCreator : PageTransformer { } -class PackageListCreator(val context: DokkaContext, val format: LinkFormat, val fileName: String = "package-list") : PageTransformer { +class PackageListCreator(val context: DokkaContext, val format: LinkFormat, val outputFilesNames: List<String> = listOf("package-list")) : PageTransformer { override fun invoke(input: RootPageNode) = input.modified(children = input.children.map { it.takeUnless { it is ModulePage } @@ -19,10 +19,14 @@ class PackageListCreator(val context: DokkaContext, val format: LinkFormat, val }) - private fun packageList(pageNode: RootPageNode) = - RendererSpecificResourcePage( - "${pageNode.name}/${fileName}", - emptyList(), - RenderingStrategy.Write(PackageListService(context).formatPackageList(pageNode, format.formatName, format.linkExtension)) - ) + private fun packageList(pageNode: RootPageNode): List<RendererSpecificPage> { + val content = PackageListService(context).formatPackageList(pageNode, format.formatName, format.linkExtension) + return outputFilesNames.map { fileName -> + RendererSpecificResourcePage( + "${pageNode.name}/${fileName}", + emptyList(), + RenderingStrategy.Write(content) + ) + } + } } 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 48d6120f..e86816a3 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 @@ -63,7 +63,7 @@ class JavadocPlugin : DokkaPlugin() { PackageListCreator( context = it, format = RecognizedLinkFormat.DokkaJavadoc, - fileName = "element-list" + outputFilesNames = listOf("package-list", "element-list") ) } order { after(rootCreator) } } 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 b3b21909..431f4464 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 @@ -33,6 +33,7 @@ internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() { package1 """.trimIndent() assertEquals(expected, contents["/element-list"]?.trimIndent()) + assertEquals(expected, contents["/package-list"]?.trimIndent()) } } @@ -69,6 +70,7 @@ internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() { package1.package1Inner.package1InnerInner """.trimIndent() assertEquals(expected, contents["/element-list"]?.trimIndent()) + assertEquals(expected, contents["/package-list"]?.trimIndent()) } } }
\ No newline at end of file |