From a5d43f6f3fb96a1122c5a85f256d093c48d83ffa Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Fri, 21 Aug 2020 16:29:01 +0200 Subject: Fix SourceLinksTransformer#DocumentableSource#toLink --- .../kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugins/base/src/main/kotlin/transformers') diff --git a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt index 13f70603..8f6f09fb 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt @@ -75,6 +75,9 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent } private fun DocumentableSource.toLink(sourceLink: SourceLink): String { + val sourcePath = File(this.path).canonicalPath.replace("\\", "/") + val sourceLinkPath = File(sourceLink.path).canonicalPath.replace("\\", "/") + val lineNumber = when (this) { is DescriptorDocumentableSource -> this.descriptor .cast() @@ -84,7 +87,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent else -> null } return sourceLink.url + - this.path.split(sourceLink.path)[1] + + sourcePath.split(sourceLinkPath)[1] + sourceLink.lineSuffix + "${lineNumber ?: 1}" } -- cgit