aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-module-page/src
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-10-28 21:54:00 +0100
committerBłażej Kardyś <bkardys@virtuslab.com>2020-11-27 03:15:02 +0100
commited56e7bcdceac7a13eae851e02f642c0762aaf40 (patch)
tree0f06aee6b251dfbecdc8ebf55a1af37e66b091ba /plugins/all-module-page/src
parentd41965ca3cb180bc82bd5dd6fa747d2b83381b31 (diff)
downloaddokka-ed56e7bcdceac7a13eae851e02f642c0762aaf40.tar.gz
dokka-ed56e7bcdceac7a13eae851e02f642c0762aaf40.tar.bz2
dokka-ed56e7bcdceac7a13eae851e02f642c0762aaf40.zip
Moving SingleGeneration to base pluing
Diffstat (limited to 'plugins/all-module-page/src')
-rw-r--r--plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt10
-rw-r--r--plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt10
2 files changed, 14 insertions, 6 deletions
diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
index f654514a..1ba63627 100644
--- a/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
+++ b/plugins/all-module-page/src/main/kotlin/AllModulesPageGeneration.kt
@@ -6,9 +6,11 @@ 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 {
+
override fun Timer.generate() {
report("Creating all modules page")
val pages = createAllModulePage()
@@ -20,17 +22,19 @@ class AllModulesPageGeneration(private val context: DokkaContext) : Generation {
render(transformedPages)
report("Processing submodules")
- context.plugin<AllModulesPagePlugin>().querySingle { templateProcessor }.process()
+ allModulesPagePlugin().querySingle { templateProcessor }.process()
}
override val generationName = "index page for project"
- fun createAllModulePage() = context.single(CoreExtensions.allModulePageCreator).invoke()
+ fun createAllModulePage() = allModulesPagePlugin().querySingle { allModulePageCreator }.invoke()
fun transformAllModulesPage(pages: RootPageNode) =
- context[CoreExtensions.allModulePageTransformer].fold(pages) { acc, t -> t(acc) }
+ allModulesPagePlugin().query { allModulePageTransformer }.fold(pages) { acc, t -> t(acc) }
fun render(transformedPages: RootPageNode) {
context.single(CoreExtensions.renderer).render(transformedPages)
}
+
+ private fun allModulesPagePlugin() = context.plugin<AllModulesPagePlugin>()
} \ No newline at end of file
diff --git a/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt
index f1ed8c1e..a65c0c58 100644
--- a/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt
+++ b/plugins/all-module-page/src/main/kotlin/AllModulesPagePlugin.kt
@@ -4,15 +4,19 @@ import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.allModulesPage.templates.*
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.plugability.DokkaPlugin
+import org.jetbrains.dokka.transformers.pages.PageCreator
+import org.jetbrains.dokka.transformers.pages.PageTransformer
class AllModulesPagePlugin : DokkaPlugin() {
+
val templateProcessor by extensionPoint<TemplateProcessor>()
+ val allModulePageCreator by extensionPoint<PageCreator>()
+ val allModulePageTransformer by extensionPoint<PageTransformer>()
val substitutor by extensionPoint<Substitutor>()
val allModulePageCreators by extending {
- (CoreExtensions.allModulePageCreator
- providing ::MultimodulePageCreator)
+ allModulePageCreator providing ::MultimodulePageCreator
}
val multimoduleLocationProvider by extending {
@@ -25,7 +29,7 @@ class AllModulesPagePlugin : DokkaPlugin() {
val allModulesPageGeneration by extending {
(CoreExtensions.generation
providing ::AllModulesPageGeneration
- override CoreExtensions.singleGeneration)
+ override plugin<DokkaBase>().singleGeneration)
}
val defaultTemplateProcessor by extending {