diff options
author | Szymon Świstun <sswistun@virtuslab.com> | 2020-02-14 14:25:48 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-18 14:06:53 +0100 |
commit | 9273d18c9edf7ea2aa265d53a9ae971e3e28a87d (patch) | |
tree | 752fc1a189dc7d930dfba09d07bd0a893ea8f3b4 /plugins | |
parent | 0b6b990d286e22bd86aef3a7e73fbfb38ffa04ef (diff) | |
download | dokka-9273d18c9edf7ea2aa265d53a9ae971e3e28a87d.tar.gz dokka-9273d18c9edf7ea2aa265d53a9ae971e3e28a87d.tar.bz2 dokka-9273d18c9edf7ea2aa265d53a9ae971e3e28a87d.zip |
Add extension for html preprocessors
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/base/src/main/kotlin/DokkaBase.kt | 24 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 11 |
2 files changed, 27 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index d236aa01..8934dd7f 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -3,7 +3,7 @@ package org.jetbrains.dokka.base import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.base.renderers.FileWriter import org.jetbrains.dokka.base.renderers.OutputWriter -import org.jetbrains.dokka.base.renderers.html.HtmlRenderer +import org.jetbrains.dokka.base.renderers.html.* import org.jetbrains.dokka.base.resolvers.DefaultLocationProviderFactory import org.jetbrains.dokka.base.resolvers.LocationProviderFactory import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider @@ -21,6 +21,7 @@ import org.jetbrains.dokka.base.translators.descriptors.DefaultDescriptorToDocum import org.jetbrains.dokka.base.translators.documentables.DefaultDocumentableToPageTranslator import org.jetbrains.dokka.base.translators.psi.DefaultPsiToDocumentableTranslator import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.transformers.pages.PageTransformer class DokkaBase : DokkaPlugin() { val pageMergerStrategy by extensionPoint<PageMergerStrategy>() @@ -28,6 +29,7 @@ class DokkaBase : DokkaPlugin() { val signatureProvider by extensionPoint<SignatureProvider>() val locationProviderFactory by extensionPoint<LocationProviderFactory>() val outputWriter by extensionPoint<OutputWriter>() + val htmlPreprocessors by extensionPoint<PageTransformer>() val descriptorToDocumentableTranslator by extending(isFallback = true) { CoreExtensions.descriptorToDocumentableTranslator providing ::DefaultDescriptorToDocumentableTranslator @@ -94,4 +96,24 @@ class DokkaBase : DokkaPlugin() { val fileWriter by extending(isFallback = true) { outputWriter providing ::FileWriter } + + val rootCreator by extending { + htmlPreprocessors with RootCreator + } + + val navigationPageInstaller by extending { + htmlPreprocessors with NavigationPageInstaller order { after(rootCreator) } + } + + val searchPageInstaller by extending { + htmlPreprocessors with SearchPageInstaller order { after(rootCreator) } + } + + val resourceInstaller by extending { + htmlPreprocessors with ResourceInstaller order { after(rootCreator) } + } + + val styleAndScriptsAppender by extending { + htmlPreprocessors with StyleAndScriptsAppender order { after(rootCreator) } + } }
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 57915134..365405ed 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -2,11 +2,14 @@ package org.jetbrains.dokka.base.renderers.html import kotlinx.html.* import kotlinx.html.stream.createHTML +import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.DefaultRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.DFunction import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.plugability.plugin +import org.jetbrains.dokka.plugability.query import java.io.File open class HtmlRenderer( @@ -15,13 +18,7 @@ open class HtmlRenderer( private val pageList = mutableListOf<String>() - override val preprocessors = listOf( - RootCreator, - SearchPageInstaller, - ResourceInstaller, - NavigationPageInstaller, - StyleAndScriptsAppender - ) + override val preprocessors = context.plugin<DokkaBase>().query { htmlPreprocessors } override fun FlowContent.wrapGroup( node: ContentGroup, |