diff options
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt | 33 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 14 |
2 files changed, 38 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index fe2913a4..d9ff924b 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -108,15 +108,8 @@ abstract class DefaultRenderer<T>( is ContentHeader -> buildHeader(node, pageContext, sourceSetRestriction) is ContentCodeBlock -> buildCodeBlock(node, pageContext) is ContentCodeInline -> buildCodeInline(node, pageContext) - is ContentDRILink -> - locationProvider.resolve(node.address, node.sourceSets, pageContext)?.let { address -> - buildLink(address) { - buildText(node.children, pageContext, sourceSetRestriction) - } - } ?: buildText(node.children, pageContext, sourceSetRestriction) - is ContentResolvedLink -> buildLink(node.address) { - buildText(node.children, pageContext, sourceSetRestriction) - } + is ContentDRILink -> buildDRILink(node, pageContext, sourceSetRestriction) + is ContentResolvedLink -> buildResolvedLink(node, pageContext, sourceSetRestriction) is ContentEmbeddedResource -> buildResource(node, pageContext) is ContentList -> buildList(node, pageContext, sourceSetRestriction) is ContentTable -> buildTable(node, pageContext, sourceSetRestriction) @@ -130,6 +123,28 @@ abstract class DefaultRenderer<T>( } } + open fun T.buildDRILink( + node: ContentDRILink, + pageContext: ContentPage, + sourceSetRestriction: Set<DokkaSourceSet>? + ) { + locationProvider.resolve(node.address, node.sourceSets, pageContext)?.let { address -> + buildLink(address) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } ?: buildText(node.children, pageContext, sourceSetRestriction) + } + + open fun T.buildResolvedLink( + node: ContentResolvedLink, + pageContext: ContentPage, + sourceSetRestriction: Set<DokkaSourceSet>? + ) { + buildLink(node.address) { + buildText(node.children, pageContext, sourceSetRestriction) + } + } + open fun T.buildDivergentInstance(node: ContentDivergentInstance, pageContext: ContentPage) { node.before?.build(this, pageContext) node.divergent.build(this, pageContext) 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 |