diff options
-rw-r--r-- | core/build.gradle.kts | 1 | ||||
-rw-r--r-- | core/src/main/kotlin/CoreExtensions.kt | 5 | ||||
-rw-r--r-- | core/src/main/kotlin/plugability/DefaultExtensions.kt | 10 | ||||
-rw-r--r-- | plugins/base/build.gradle.kts | 4 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/DokkaBase.kt | 10 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt (renamed from core/src/main/kotlin/renderers/DefaultRenderer.kt) | 7 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt (renamed from core/src/main/kotlin/renderers/html/HtmlRenderer.kt) | 5 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt (renamed from core/src/main/kotlin/renderers/html/NavigationPage.kt) | 0 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt (renamed from core/src/main/kotlin/renderers/html/htmlPreprocessors.kt) | 2 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt (renamed from core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt) | 16 |
10 files changed, 34 insertions, 26 deletions
diff --git a/core/build.gradle.kts b/core/build.gradle.kts index fbe9d563..365cf7e8 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -10,7 +10,6 @@ dependencies { val kotlin_version: String by project api("org.jetbrains.kotlin:kotlin-compiler:$kotlin_version") - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10") implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") implementation("org.jsoup:jsoup:1.12.1") diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt index 8ae333ee..2d705c1b 100644 --- a/core/src/main/kotlin/CoreExtensions.kt +++ b/core/src/main/kotlin/CoreExtensions.kt @@ -24,12 +24,13 @@ object CoreExtensions { val psiToDocumentationTranslator by coreExtension<PsiToDocumentationTranslator>() val documentableMerger by coreExtension<DocumentableMerger>() val documentationTransformer by coreExtension<DocumentationNodeTransformer>() - val commentsToContentConverter by coreExtension<CommentsToContentConverter>() val documentablesToPageTranslator by coreExtension<DocumentablesToPageTranslator>() val pageTransformer by coreExtension<PageNodeTransformer>() + val renderer by coreExtension<Renderer>() + + val commentsToContentConverter by coreExtension<CommentsToContentConverter>() val locationProviderFactory by coreExtension<LocationProviderFactory>() val outputWriter by coreExtension<OutputWriter>() - val renderer by coreExtension<Renderer>() val pageMergerStrategy by coreExtension<PageMergerStrategy>() private fun <T: Any> coreExtension() = object { diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt index 7c76afe7..828d1bf1 100644 --- a/core/src/main/kotlin/plugability/DefaultExtensions.kt +++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt @@ -4,20 +4,12 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.pages.DocTagToContentConverter import org.jetbrains.dokka.renderers.FileWriter import org.jetbrains.dokka.renderers.OutputWriter -import org.jetbrains.dokka.renderers.html.HtmlRenderer import org.jetbrains.dokka.resolvers.DefaultLocationProviderFactory import org.jetbrains.dokka.transformers.pages.DefaultPageMergerStrategy -import org.jetbrains.dokka.transformers.psi.DefaultPsiToDocumentationTranslator import org.jetbrains.dokka.transformers.pages.DefaultPageNodeMerger internal object DefaultExtensions { - private val renderer: LazyEvaluated<HtmlRenderer> = LazyEvaluated.fromRecipe { - HtmlRenderer( - it.single(CoreExtensions.outputWriter), - it - ) - } private val converter: LazyEvaluated<DocTagToContentConverter> = LazyEvaluated.fromRecipe { DocTagToContentConverter(it) } private val providerFactory: LazyEvaluated<DefaultLocationProviderFactory> = LazyEvaluated.fromRecipe { DefaultLocationProviderFactory(it) } private val outputWriter: LazyEvaluated<OutputWriter> = LazyEvaluated.fromRecipe { FileWriter(it) } @@ -25,10 +17,8 @@ internal object DefaultExtensions { @Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST") internal fun <T : Any, E : ExtensionPoint<T>> get(point: E, fullContext: DokkaContext): List<T> = when (point) { - CoreExtensions.psiToDocumentationTranslator -> DefaultPsiToDocumentationTranslator CoreExtensions.commentsToContentConverter -> converter.get(fullContext) CoreExtensions.pageTransformer -> DefaultPageNodeMerger(fullContext) - CoreExtensions.renderer -> renderer.get(fullContext) CoreExtensions.locationProviderFactory -> providerFactory.get(fullContext) CoreExtensions.outputWriter -> outputWriter.get(fullContext) CoreExtensions.pageMergerStrategy -> DefaultPageMergerStrategy(fullContext.logger) diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index ba0b5753..b42d7e28 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -7,3 +7,7 @@ publishing { } } +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10") +} + diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index 34c0ffae..bafd30ff 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -4,13 +4,19 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.base.transformers.descriptors.DefaultDescriptorToDocumentationTranslator import org.jetbrains.dokka.base.transformers.documentables.DefaultDocumentableMerger import org.jetbrains.dokka.base.transformers.documentables.DefaultDocumentablesToPageTranslator +import org.jetbrains.dokka.base.transformers.psi.DefaultPsiToDocumentationTranslator import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.renderers.html.HtmlRenderer class DokkaBase: DokkaPlugin() { val descriptorToDocumentationTranslator by extending(isFallback = true) { CoreExtensions.descriptorToDocumentationTranslator providing ::DefaultDescriptorToDocumentationTranslator } + val psiToDocumentationTranslator by extending(isFallback = true) { + CoreExtensions.psiToDocumentationTranslator with DefaultPsiToDocumentationTranslator + } + val documentableMerger by extending(isFallback = true) { CoreExtensions.documentableMerger with DefaultDocumentableMerger } @@ -18,4 +24,8 @@ class DokkaBase: DokkaPlugin() { val documentablesToPageTranslator by extending(isFallback = true) { CoreExtensions.documentablesToPageTranslator with DefaultDocumentablesToPageTranslator } + + val htmlRenderer by extending { + CoreExtensions.renderer providing ::HtmlRenderer + } }
\ No newline at end of file diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index d09d9ded..c6183cf3 100644 --- a/core/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -1,16 +1,19 @@ -package org.jetbrains.dokka.renderers +package org.jetbrains.dokka.base.renderers import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.renderers.OutputWriter +import org.jetbrains.dokka.renderers.Renderer import org.jetbrains.dokka.resolvers.LocationProvider import org.jetbrains.dokka.transformers.pages.PageNodeTransformer abstract class DefaultRenderer<T>( - protected val outputWriter: OutputWriter, protected val context: DokkaContext ) : Renderer { + protected val outputWriter = context.single(CoreExtensions.outputWriter) + protected lateinit var locationProvider: LocationProvider private set diff --git a/core/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 376ce5c8..c9270681 100644 --- a/core/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -2,18 +2,17 @@ package org.jetbrains.dokka.renderers.html import kotlinx.html.* import kotlinx.html.stream.createHTML +import org.jetbrains.dokka.base.renderers.DefaultRenderer import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.renderers.DefaultRenderer import org.jetbrains.dokka.renderers.OutputWriter import java.io.File open class HtmlRenderer( - outputWriter: OutputWriter, context: DokkaContext -) : DefaultRenderer<FlowContent>(outputWriter, context) { +) : DefaultRenderer<FlowContent>(context) { private val pageList = mutableListOf<String>() diff --git a/core/src/main/kotlin/renderers/html/NavigationPage.kt b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt index 4a2fb40d..4a2fb40d 100644 --- a/core/src/main/kotlin/renderers/html/NavigationPage.kt +++ b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt diff --git a/core/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index 4ee67448..09164d97 100644 --- a/core/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -4,8 +4,8 @@ import kotlinx.html.h1 import kotlinx.html.id import kotlinx.html.table import kotlinx.html.tbody +import org.jetbrains.dokka.base.renderers.platforms import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.renderers.platforms import org.jetbrains.dokka.transformers.pages.PageNodeTransformer object RootCreator : PageNodeTransformer { diff --git a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt b/plugins/base/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt index 055df0b2..b913ae88 100644 --- a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt +++ b/plugins/base/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt @@ -1,7 +1,6 @@ -package org.jetbrains.dokka.transformers.psi +package org.jetbrains.dokka.base.transformers.psi import com.intellij.psi.* -import com.intellij.psi.impl.source.PsiClassReferenceType import org.jetbrains.dokka.JavadocParser import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI @@ -11,10 +10,9 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.pages.PlatformData import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.transformers.psi.PsiToDocumentationTranslator import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.kotlin.descriptors.Visibilities -import org.jetbrains.kotlin.idea.caches.project.getPlatformModuleInfo -import org.jetbrains.kotlin.platform.TargetPlatform object DefaultPsiToDocumentationTranslator : PsiToDocumentationTranslator { @@ -24,7 +22,11 @@ object DefaultPsiToDocumentationTranslator : PsiToDocumentationTranslator { platformData: PlatformData, context: DokkaContext ): Module { - val docParser = DokkaPsiParser(platformData, context.logger) + val docParser = + DokkaPsiParser( + platformData, + context.logger + ) return Module(moduleName, psiFiles.map { psiFile -> val dri = DRI(packageName = psiFile.packageName) @@ -124,14 +126,14 @@ object DefaultPsiToDocumentationTranslator : PsiToDocumentationTranslator { private fun parseField(psi: PsiField, parent: DRI): Property { val dri = parent.copy( callable = Callable( - psi.name, + psi.name!!, // TODO: Investigate if this is indeed nullable JavaClassReference(psi.containingClass?.name.orEmpty()), emptyList() ) ) return Property( dri, - psi.name, + psi.name!!, // TODO: Investigate if this is indeed nullable null, null, getComment(psi), |