aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt
new file mode 100644
index 00000000..a6e09bac
--- /dev/null
+++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt
@@ -0,0 +1,20 @@
+package org.jetbrains.dokka.base.resolvers.external
+
+import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo
+import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat
+import org.jetbrains.dokka.plugability.DokkaContext
+
+class DefaultExternalLocationProviderFactory(val context: DokkaContext) :
+ ExternalLocationProviderFactory by ExternalLocationProviderFactoryWithCache(
+ object : ExternalLocationProviderFactory {
+ override fun getExternalLocationProvider(docInfo: ExternalDocumentationInfo): ExternalLocationProvider? =
+ when (docInfo.packageList.linkFormat) {
+ RecognizedLinkFormat.KotlinWebsiteHtml,
+ RecognizedLinkFormat.DokkaOldHtml,
+ RecognizedLinkFormat.DokkaHtml -> DefaultExternalLocationProvider(docInfo, ".html", context)
+ RecognizedLinkFormat.DokkaGFM,
+ RecognizedLinkFormat.DokkaJekyll -> DefaultExternalLocationProvider(docInfo, ".md", context)
+ else -> null
+ }
+ }
+ ) \ No newline at end of file