aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-21 16:29:01 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-24 17:05:30 +0200
commita5d43f6f3fb96a1122c5a85f256d093c48d83ffa (patch)
tree61d92a82db6ebc10ca6f9c0f565bd52a710d6abc /plugins/base/src/main/kotlin/transformers
parent708ed6a1e23c854e2e3db78881dfdd8a6992700b (diff)
downloaddokka-a5d43f6f3fb96a1122c5a85f256d093c48d83ffa.tar.gz
dokka-a5d43f6f3fb96a1122c5a85f256d093c48d83ffa.tar.bz2
dokka-a5d43f6f3fb96a1122c5a85f256d093c48d83ffa.zip
Fix SourceLinksTransformer#DocumentableSource#toLink
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt5
1 files changed, 4 insertions, 1 deletions
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<DeclarationDescriptorWithSource>()
@@ -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}"
}