From 4b61be354510cf88fed33860c987bd210502e91d Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 26 Feb 2015 21:17:13 +0100 Subject: don't generate redundant links that lead to the same page with no anchor (e.g. receiver type in extension functions) --- src/Locations/LocationService.kt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Locations/LocationService.kt') diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt index cb05535a..2c93ba8f 100644 --- a/src/Locations/LocationService.kt +++ b/src/Locations/LocationService.kt @@ -23,6 +23,9 @@ public data class FileLocation(val file: File): Location { if (other !is FileLocation) { throw IllegalArgumentException("$other is not a FileLocation") } + if (file.path.substringBeforeLast(".") == other.file.path.substringBeforeLast(".") && anchor == null) { + return "." + } val ownerFolder = file.getParentFile()!! val relativePath = ownerFolder.getRelativePath(other.file).path return if (anchor == null) relativePath else relativePath + "#" + anchor -- cgit