diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-01-05 12:19:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 12:19:01 +0100 |
commit | ef98e4b6505c3fdd192b1d5057c718079d27b972 (patch) | |
tree | ca93d1482422f4b882715721234e4ab4352e474a /plugins/base/src/main | |
parent | d3f0e03284999e6f7fac99a345ed91cb63503706 (diff) | |
download | dokka-ef98e4b6505c3fdd192b1d5057c718079d27b972.tar.gz dokka-ef98e4b6505c3fdd192b1d5057c718079d27b972.tar.bz2 dokka-ef98e4b6505c3fdd192b1d5057c718079d27b972.zip |
Fix a bug with inserting template commands instead of link text (#1685)
Some test methods were dropped intentionally, as using them can lead to subtle bugs. The same methods are available in the base-test-utils module
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 2a24a959..1584df02 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -1,8 +1,5 @@ package org.jetbrains.dokka.base.renderers.html -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import kotlinx.html.* import kotlinx.html.stream.createHTML import org.jetbrains.dokka.DokkaSourceSetID @@ -644,18 +641,13 @@ open class HtmlRenderer( ) = locationProvider.resolve(to, platforms.toSet(), from)?.let { buildLink(it, block) } ?: run { context.logger.error("Cannot resolve path for `$to` from `$from`"); block() } - override fun buildError(node: ContentNode) { - context.logger.error("Unknown ContentNode type: $node") - } + override fun buildError(node: ContentNode) = context.logger.error("Unknown ContentNode type: $node") - override fun FlowContent.buildNewLine() { - br() - } + override fun FlowContent.buildNewLine() = br() override fun FlowContent.buildLink(address: String, content: FlowContent.() -> Unit) = a(href = address, block = content) - override fun FlowContent.buildDRILink( node: ContentDRILink, pageContext: ContentPage, @@ -664,8 +656,15 @@ open class HtmlRenderer( buildLink(address) { buildText(node.children, pageContext, sourceSetRestriction) } - } ?: templateCommand(ResolveLinkCommand(node.address)) { - buildText(node.children, pageContext, sourceSetRestriction) + } ?: if (isPartial) { + templateCommand(ResolveLinkCommand(node.address)) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } else { + span { + attributes["data-unresolved-link"] = node.address.toString().htmlEscape() + buildText(node.children, pageContext, sourceSetRestriction) + } } override fun FlowContent.buildCodeBlock( @@ -823,6 +822,7 @@ open class HtmlRenderer( (locationProvider as DokkaBaseLocationProvider).anchorForDCI(DCI(dci.dri, contentKind), sourceSets) } + private val isPartial = context.configuration.delayTemplateSubstitution } fun List<SimpleAttr>.joinAttr() = joinToString(" ") { it.extraKey + "=" + it.extraValue } |