From 8c218ff4dd5f970233c43845c19299fc74256389 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Fri, 29 Apr 2022 15:03:08 +0300 Subject: Enable warnings as errors and fix all warnings (#2451) * Enable warnings as errors and fix all warnings * Enable skip-metadata-version-check compiler setting --- .../dokka/gfm/renderer/CommonmarkRenderer.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'plugins/gfm/src/main/kotlin') diff --git a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt index 786e410d..13322944 100644 --- a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt @@ -99,15 +99,20 @@ open class CommonmarkRenderer( pageContext: ContentPage, sourceSetRestriction: Set? ) { - locationProvider.resolve(node.address, node.sourceSets, pageContext)?.let { - buildLink(it) { + val location = locationProvider.resolve(node.address, node.sourceSets, pageContext) + if (location == null) { + if (isPartial) { + templateCommand(ResolveLinkGfmCommand(node.address)) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } else { buildText(node.children, pageContext, sourceSetRestriction) } - } ?: if (isPartial) { - templateCommand(ResolveLinkGfmCommand(node.address)) { + } else { + buildLink(location) { buildText(node.children, pageContext, sourceSetRestriction) } - } else buildText(node.children, pageContext, sourceSetRestriction) + } } override fun StringBuilder.buildLineBreak() { @@ -253,11 +258,11 @@ open class CommonmarkRenderer( override fun StringBuilder.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) { val distinct = - node.groupDivergentInstances(pageContext, { instance, contentPage, sourceSet -> + node.groupDivergentInstances(pageContext, { instance, _, sourceSet -> instance.before?.let { before -> buildString { buildContentNode(before, pageContext, sourceSet) } } ?: "" - }, { instance, contentPage, sourceSet -> + }, { instance, _, sourceSet -> instance.after?.let { after -> buildString { buildContentNode(after, pageContext, sourceSet) } } ?: "" -- cgit