aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt')
-rw-r--r--plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
new file mode 100644
index 00000000..815cf160
--- /dev/null
+++ b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
@@ -0,0 +1,31 @@
+package org.jetbrains.dokka.allModulesPage
+
+import org.jetbrains.dokka.CoreExtensions
+import org.jetbrains.dokka.Timer
+import org.jetbrains.dokka.generation.Generation
+import org.jetbrains.dokka.pages.RootPageNode
+import org.jetbrains.dokka.plugability.DokkaContext
+
+class AllModulesPageGeneration(private val context: DokkaContext) : Generation {
+ override fun Timer.generate() {
+ report("Creating all modules page")
+ val pages = createAllModulePage()
+
+ report("Transforming pages")
+ val transformedPages = transformAllModulesPage(pages)
+
+ report("Rendering")
+ render(transformedPages)
+ }
+
+ override val generationName = "index page for project"
+
+ fun createAllModulePage() = context.single(CoreExtensions.allModulePageCreator).invoke()
+
+ fun transformAllModulesPage(pages: RootPageNode) =
+ context[CoreExtensions.allModulePageTransformer].fold(pages) { acc, t -> t(acc) }
+
+ fun render(transformedPages: RootPageNode) {
+ context.single(CoreExtensions.renderer).render(transformedPages)
+ }
+} \ No newline at end of file