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

import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.pages.DefaultMarkdownToContentConverter
import org.jetbrains.dokka.renderers.DefaultRenderer
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.renderer -> ::HtmlRenderer
            CoreExtensions.locationProvider -> ::DefaultLocationProvider
            CoreExtensions.fileExtension -> ".html"
            else -> null
        }.let { listOfNotNull(it) as List<T> }
}