aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-11-20 17:23:10 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2020-11-27 03:15:02 +0100
commit3cb4702a68139788de6e1f7b087ced345f2b71ba (patch)
treea383471c9915ae4aaff078b4f3b81bb99a4fde35 /plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
parent076a5f421c5e4621539efd814be612f43fef33f5 (diff)
downloaddokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.tar.gz
dokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.tar.bz2
dokka-3cb4702a68139788de6e1f7b087ced345f2b71ba.zip
Changing how multimodule location provider works and improving gfm link substitution
Diffstat (limited to 'plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt')
-rw-r--r--plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
new file mode 100644
index 00000000..5ac854b4
--- /dev/null
+++ b/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
@@ -0,0 +1,43 @@
+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
+import org.jetbrains.dokka.plugability.plugin
+import org.jetbrains.dokka.plugability.query
+import org.jetbrains.dokka.plugability.querySingle
+
+class AllModulesPageGeneration(private val context: DokkaContext) : Generation {
+
+ private val allModulesPagePlugin by lazy { context.plugin<AllModulesPagePlugin>() }
+
+ override fun Timer.generate() {
+ report("Creating all modules page")
+ val pages = createAllModulesPage()
+
+ report("Transforming pages")
+ val transformedPages = transformAllModulesPage(pages)
+
+ report("Rendering")
+ render(transformedPages)
+
+ report("Processing submodules")
+ processSubmodules()
+ }
+
+ override val generationName = "index page for project"
+
+ fun createAllModulesPage() = allModulesPagePlugin.querySingle { allModulesPageCreator }.invoke()
+
+ fun transformAllModulesPage(pages: RootPageNode) =
+ allModulesPagePlugin.query { allModulesPageTransformer }.fold(pages) { acc, t -> t(acc) }
+
+ fun render(transformedPages: RootPageNode) {
+ context.single(CoreExtensions.renderer).render(transformedPages)
+ }
+
+ fun processSubmodules() =
+ allModulesPagePlugin.querySingle { templateProcessor }.process()
+} \ No newline at end of file