aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-08-20 16:58:23 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-21 16:40:57 +0200
commit705cbd313838db9f0c64d8f2bc7947ccbb40ed19 (patch)
tree5930bddf15096c03629e10413632ba0dfa779197 /plugins
parent39b64feead5718ae9d3e4293407cf0858057493a (diff)
downloaddokka-705cbd313838db9f0c64d8f2bc7947ccbb40ed19.tar.gz
dokka-705cbd313838db9f0c64d8f2bc7947ccbb40ed19.tar.bz2
dokka-705cbd313838db9f0c64d8f2bc7947ccbb40ed19.zip
Generate output to package-list and element-list
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/renderers/preprocessors.kt18
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt2
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt2
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