From 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Thu, 31 Aug 2023 20:16:01 +0200 Subject: Enable explicit API mode (#3139) --- core/src/main/kotlin/pages/RendererSpecificPage.kt | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'core/src/main/kotlin/pages/RendererSpecificPage.kt') diff --git a/core/src/main/kotlin/pages/RendererSpecificPage.kt b/core/src/main/kotlin/pages/RendererSpecificPage.kt index c8661ae5..701886b7 100644 --- a/core/src/main/kotlin/pages/RendererSpecificPage.kt +++ b/core/src/main/kotlin/pages/RendererSpecificPage.kt @@ -9,14 +9,14 @@ import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.renderers.Renderer import kotlin.reflect.KClass -fun interface DriResolver: (DRI, Set) -> String? -fun interface PageResolver: (PageNode, PageNode?) -> String? +public fun interface DriResolver: (DRI, Set) -> String? +public fun interface PageResolver: (PageNode, PageNode?) -> String? -interface RendererSpecificPage : PageNode { - val strategy: RenderingStrategy +public interface RendererSpecificPage : PageNode { + public val strategy: RenderingStrategy } -class RendererSpecificRootPage( +public class RendererSpecificRootPage( override val name: String, override val children: List, override val strategy: RenderingStrategy @@ -25,7 +25,7 @@ class RendererSpecificRootPage( RendererSpecificRootPage(name, children, strategy) } -class RendererSpecificResourcePage( +public class RendererSpecificResourcePage( override val name: String, override val children: List, override val strategy: RenderingStrategy @@ -34,18 +34,19 @@ class RendererSpecificResourcePage( RendererSpecificResourcePage(name, children, strategy) } -sealed class RenderingStrategy { - class Callback(val instructions: Renderer.(PageNode) -> String): RenderingStrategy() - data class Copy(val from: String) : RenderingStrategy() - data class Write(val text: String) : RenderingStrategy() - data class DriLocationResolvableWrite(val contentToResolve: (DriResolver) -> String) : RenderingStrategy() - data class PageLocationResolvableWrite(val contentToResolve: (PageResolver) -> String) : RenderingStrategy() - object DoNothing : RenderingStrategy() - - companion object { - inline operator fun invoke(crossinline instructions: T.(PageNode) -> String) = - Callback { if (this is T) instructions(it) else throw WrongRendererTypeException(T::class) } +public sealed class RenderingStrategy { + public class Callback(public val instructions: Renderer.(PageNode) -> String): RenderingStrategy() + public data class Copy(val from: String) : RenderingStrategy() + public data class Write(val text: String) : RenderingStrategy() + public data class DriLocationResolvableWrite(val contentToResolve: (DriResolver) -> String) : RenderingStrategy() + public data class PageLocationResolvableWrite(val contentToResolve: (PageResolver) -> String) : RenderingStrategy() + public object DoNothing : RenderingStrategy() + + public companion object { + public inline operator fun invoke(crossinline instructions: T.(PageNode) -> String): RenderingStrategy { + return Callback { if (this is T) instructions(it) else throw WrongRendererTypeException(T::class) } + } } } -data class WrongRendererTypeException(val expectedType: KClass<*>): Exception() +public data class WrongRendererTypeException(val expectedType: KClass<*>): Exception() -- cgit