Skip to content

KaPieceRenderer

abstract class KaPieceRenderer<T>(val piece: KaPiece<T>)

Renders a single KaPiece into the contextual KaRenderingOutput.

Renderers for a given piece form a stack within a KaRenderer; KaRendererBuilder.push adds one on top. A renderer may emit nested pieces via the top-level render function and fall back to the renderer beneath it by invoking its next callback.

Parameters

  • piece: the piece this renderer is responsible for.

Constructors

KaPieceRenderer

constructor(piece: KaPiece<T>)

Parameters

  • piece: the piece this renderer is responsible for.

Types

Companion

object Companion

Properties

piece

val piece: KaPiece<T>

Parameters

  • piece: the piece this renderer is responsible for.

Functions

render

context(
    session: KaSession, 
    context: KaRenderingContext, 
    output: KaRenderingOutput
)
abstract fun render(value: T, next: () -> Unit): Boolean

Renders value into the contextual KaRenderingOutput. Returns true if the value was handled, or false to fall back to the renderer beneath this one.

Invoke next to render value with the renderer immediately beneath this one. After calling next, you are supposed to return true; otherwise, the next will render the value twice.