aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-07-29 11:27:07 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-19 13:34:10 +0200
commitb072356193b98bd34c688c21611180ea68c7f32c (patch)
treedb5810dc569a4f767209bb203b2d62b3c5d88932 /plugins/base/src/main/kotlin/renderers/html
parentab9bcc534768e9886a308bd567219cd8a3208bb1 (diff)
downloaddokka-b072356193b98bd34c688c21611180ea68c7f32c.tar.gz
dokka-b072356193b98bd34c688c21611180ea68c7f32c.tar.bz2
dokka-b072356193b98bd34c688c21611180ea68c7f32c.zip
Wrap unresolved links in `span` with `data-unresolved-link`
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 1a2a98b3..e3d54e49 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -563,6 +563,20 @@ open class HtmlRenderer(
override fun FlowContent.buildLink(address: String, content: FlowContent.() -> Unit) =
a(href = address, block = content)
+
+ override fun FlowContent.buildDRILink(
+ node: ContentDRILink,
+ pageContext: ContentPage,
+ sourceSetRestriction: Set<DokkaSourceSet>?
+ ) = locationProvider.resolve(node.address, node.sourceSets, pageContext)?.let { address ->
+ buildLink(address) {
+ buildText(node.children, pageContext, sourceSetRestriction)
+ }
+ } ?: span {
+ attributes["data-unresolved-link"] = "true"
+ buildText(node.children, pageContext, sourceSetRestriction)
+ }
+
override fun FlowContent.buildCodeBlock(
code: ContentCodeBlock,
pageContext: ContentPage