blob: c62bdd413bd177c428ae5e0ddbc33dc3f2a77f77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package org.jetbrains.dokka.plugability
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.pages.DocTagToContentConverter
import org.jetbrains.dokka.renderers.FileWriter
import org.jetbrains.dokka.renderers.html.HtmlRenderer
import org.jetbrains.dokka.resolvers.DefaultLocationProviderFactory
import org.jetbrains.dokka.transformers.descriptors.DefaultDescriptorToDocumentationTranslator
import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationNodeMerger
import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationToPageTranslator
import org.jetbrains.dokka.transformers.psi.DefaultPsiToDocumentationTranslator
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) }
@Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST")
internal fun <T : Any, E : ExtensionPoint<T>> get(point: E, fullContext: DokkaContext): List<T> =
when (point) {
CoreExtensions.descriptorToDocumentationTranslator -> DefaultDescriptorToDocumentationTranslator
CoreExtensions.psiToDocumentationTranslator -> DefaultPsiToDocumentationTranslator
CoreExtensions.documentationMerger -> DefaultDocumentationNodeMerger
CoreExtensions.commentsToContentConverter -> converter.get(fullContext)
CoreExtensions.documentationToPageTranslator -> DefaultDocumentationToPageTranslator
CoreExtensions.renderer -> renderer.get(fullContext)
CoreExtensions.locationProviderFactory -> providerFactory.get(fullContext)
CoreExtensions.outputWriter -> FileWriter(fullContext, "")
CoreExtensions.fileExtension -> ".html"
else -> null
}.let { listOfNotNull( it ) as List<T> }
}
|