aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/command/consumers
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /plugins/base/src/main/kotlin/renderers/html/command/consumers
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/command/consumers')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/command/consumers/ImmediateResolutionTagConsumer.kt37
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/command/consumers/PathToRootConsumer.kt26
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt29
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/command/consumers/ResolveLinkConsumer.kt34
4 files changed, 0 insertions, 126 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ImmediateResolutionTagConsumer.kt b/plugins/base/src/main/kotlin/renderers/html/command/consumers/ImmediateResolutionTagConsumer.kt
deleted file mode 100644
index 9cde1fca..00000000
--- a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ImmediateResolutionTagConsumer.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.base.renderers.html.command.consumers
-
-import kotlinx.html.TagConsumer
-import kotlinx.html.visit
-import org.jetbrains.dokka.base.DokkaBase
-import org.jetbrains.dokka.base.renderers.html.TemplateBlock
-import org.jetbrains.dokka.base.renderers.html.templateCommand
-import org.jetbrains.dokka.base.renderers.html.templateCommandFor
-import org.jetbrains.dokka.base.templating.Command
-import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.plugability.plugin
-import org.jetbrains.dokka.plugability.query
-
-public class ImmediateResolutionTagConsumer<out R>(
- private val downstream: TagConsumer<R>,
- private val context: DokkaContext
-): TagConsumer<R> by downstream {
-
- public fun processCommand(command: Command, block: TemplateBlock) {
- context.plugin<DokkaBase>().query { immediateHtmlCommandConsumer }
- .find { it.canProcess(command) }
- ?.processCommand(command, block, this)
- ?: run { templateCommandFor(command, downstream).visit(block) }
- }
-
- public fun processCommandAndFinalize(command: Command, block: TemplateBlock): R {
- return context.plugin<DokkaBase>().query { immediateHtmlCommandConsumer }
- .find { it.canProcess(command) }
- ?.processCommandAndFinalize(command, block, this)
- ?: downstream.templateCommand(command, block)
- }
-}
-
diff --git a/plugins/base/src/main/kotlin/renderers/html/command/consumers/PathToRootConsumer.kt b/plugins/base/src/main/kotlin/renderers/html/command/consumers/PathToRootConsumer.kt
deleted file mode 100644
index 9ac6eb91..00000000
--- a/plugins/base/src/main/kotlin/renderers/html/command/consumers/PathToRootConsumer.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.base.renderers.html.command.consumers
-
-import org.jetbrains.dokka.base.renderers.html.TemplateBlock
-import org.jetbrains.dokka.base.renderers.html.buildAsInnerHtml
-import org.jetbrains.dokka.base.templating.Command
-import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer
-import org.jetbrains.dokka.base.templating.PathToRootSubstitutionCommand
-
-public object PathToRootConsumer: ImmediateHtmlCommandConsumer {
- override fun canProcess(command: Command): Boolean = command is PathToRootSubstitutionCommand
-
- override fun <R> processCommand(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>) {
- command as PathToRootSubstitutionCommand
- tagConsumer.onTagContentUnsafe { +block.buildAsInnerHtml().replace(command.pattern, command.default) }
- }
-
- override fun <R> processCommandAndFinalize(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>): R {
- processCommand(command, block, tagConsumer)
- return tagConsumer.finalize()
- }
-
-}
diff --git a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt b/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt
deleted file mode 100644
index dd95c202..00000000
--- a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ReplaceVersionsConsumer.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.base.renderers.html.command.consumers
-
-import org.jetbrains.dokka.base.renderers.html.TemplateBlock
-import org.jetbrains.dokka.base.templating.Command
-import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer
-import org.jetbrains.dokka.base.templating.ReplaceVersionsCommand
-import org.jetbrains.dokka.plugability.DokkaContext
-
-public class ReplaceVersionsConsumer(private val context: DokkaContext) : ImmediateHtmlCommandConsumer {
- override fun canProcess(command: Command): Boolean = command is ReplaceVersionsCommand
-
- override fun <R> processCommand(
- command: Command,
- block: TemplateBlock,
- tagConsumer: ImmediateResolutionTagConsumer<R>
- ) {
- command as ReplaceVersionsCommand
- tagConsumer.onTagContentUnsafe { +context.configuration.moduleVersion.orEmpty() }
- }
-
- override fun <R> processCommandAndFinalize(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>): R {
- processCommand(command, block, tagConsumer)
- return tagConsumer.finalize()
- }
-}
diff --git a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ResolveLinkConsumer.kt b/plugins/base/src/main/kotlin/renderers/html/command/consumers/ResolveLinkConsumer.kt
deleted file mode 100644
index 292e88b0..00000000
--- a/plugins/base/src/main/kotlin/renderers/html/command/consumers/ResolveLinkConsumer.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.base.renderers.html.command.consumers
-
-import kotlinx.html.SPAN
-import kotlinx.html.span
-import kotlinx.html.unsafe
-import kotlinx.html.visit
-import org.jetbrains.dokka.base.renderers.html.TemplateBlock
-import org.jetbrains.dokka.base.renderers.html.buildAsInnerHtml
-import org.jetbrains.dokka.base.templating.Command
-import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer
-import org.jetbrains.dokka.base.templating.ResolveLinkCommand
-import org.jetbrains.dokka.utilities.htmlEscape
-
-public object ResolveLinkConsumer: ImmediateHtmlCommandConsumer {
- override fun canProcess(command: Command): Boolean = command is ResolveLinkCommand
-
- override fun <R> processCommand(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>) {
- command as ResolveLinkCommand
- SPAN(mapOf("data-unresolved-link" to command.dri.toString().htmlEscape()), tagConsumer).visit {
- unsafe { block.buildAsInnerHtml() }
- }
- }
-
- override fun <R> processCommandAndFinalize(command: Command, block: TemplateBlock, tagConsumer: ImmediateResolutionTagConsumer<R>): R {
- command as ResolveLinkCommand
- return tagConsumer.span {
- attributes["data-unresolved-link"] = command.dri.toString().htmlEscape()
- }
- }
-}