@@ -8,6 +8,7 @@ import org.jetbrains.dokka.base.resolvers.anchors._
88import org .jetbrains .dokka .links .DRI
99import org .jetbrains .dokka .model .DisplaySourceSet
1010import org .jetbrains .dokka .pages .RootPageNode
11+ import dotty .dokka .model .api ._
1112import org .jetbrains .dokka .plugability ._
1213import collection .JavaConverters ._
1314import java .util .{Set => JSet }
@@ -34,20 +35,20 @@ class ScalaExternalLocationProvider(
3435 }
3536
3637 private def constructPathForJavadoc (dri : DRI ): String = {
37- val packagePrefix = dri.getPackageName.replace(" ." ," /" )
38- val origin = originRegex.findFirstIn(dri.getExtra)
39- val className = origin match {
40- case Some (path) =>
41- path.split(" /" ).last.stripSuffix(" .class" )
42- case None => dri.getClassNames
43- }
44- getDocURL + packagePrefix + " /" + className + extension
38+ val location = " \\ $+" .r.replaceAllIn(dri.location.replace(" ." ," /" ), _ => " ." )
39+ val origin = originRegex.findFirstIn(dri.extra)
40+ val anchor = dri.anchor
41+ getDocURL + location + extension + anchor.fold(" " )(a => s " # $a" )
4542 }
4643
4744 private def constructPathForScaladoc (dri : DRI ): String = {
48- val packagePrefix = dri.getPackageName .replace(" ." ," /" )
49- val className = dri.getClassNames
50- getDocURL + packagePrefix + " / " + className + extension
45+ val location = dri.location .replace(" ." ," /" )
46+ val anchor = dri.anchor
47+ getDocURL + location + extension + anchor.fold( " " )(a => s " # $a " )
5148 }
5249
53- private def constructPathForScala3doc (dri : DRI ): String = super .constructPath(dri)
50+ private def constructPathForScala3doc (dri : DRI ): String = {
51+ val location = dri.location.replace(" ." ," /" )
52+ val anchor = dri.anchor
53+ getDocURL + location + anchor.fold(extension)(a => s " / $a$extension" )
54+ }
0 commit comments