aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/plugability/DefaultExtensions.kt
blob: d89fc03175602d949b72610a32d94e5a8b69303a (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
package org.jetbrains.dokka.plugability

import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.pages.DefaultMarkdownToContentConverter
import org.jetbrains.dokka.renderers.HtmlRenderer
import org.jetbrains.dokka.resolvers.DefaultLocationProvider
import org.jetbrains.dokka.transformers.descriptors.DefaultDescriptorToDocumentationTranslator
import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationNodeMerger
import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationToPageTranslator

object DefaultExtensions : DokkaExtensionHandler {
    @Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST")
    override fun <T : Any, E : ExtensionPoint<T>> get(point: E, askDefault: AskDefault): List<T> =
        when (point) {
            CoreExtensions.descriptorToDocumentationTranslator -> DefaultDescriptorToDocumentationTranslator
            CoreExtensions.documentationMerger -> DefaultDocumentationNodeMerger
            CoreExtensions.markdownToContentConverterFactory -> ::DefaultMarkdownToContentConverter
            CoreExtensions.documentationToPageTranslator -> DefaultDocumentationToPageTranslator
            CoreExtensions.rendererFactory -> ::HtmlRenderer
            CoreExtensions.locationProviderFactory -> ::DefaultLocationProvider
            CoreExtensions.fileExtension -> ".html"
            else -> null
        }.let { listOfNotNull(it) as List<T> }
}