@@ -6,7 +6,7 @@ import dotty.dokka.model.api._
6
6
import dotty .tools .dotc .core .Contexts .Context
7
7
import scala .util .matching .Regex
8
8
9
- def pathToString (p : Path ) = " / " + p.toString.replace('\\ ' , '/' )
9
+ def pathToString (p : Path ) = p.toString.replace('\\ ' , '/' )
10
10
11
11
trait SourceLink :
12
12
val path : Option [Path ] = None
@@ -22,14 +22,15 @@ case class PrefixedSourceLink(val myPath: Path, nested: SourceLink) extends Sour
22
22
case class TemplateSourceLink (val urlTemplate : String ) extends SourceLink :
23
23
override val path : Option [Path ] = None
24
24
override def render (memberName : String , path : Path , operation : String , line : Option [Int ]): String =
25
+ val pathString = " /" + pathToString(path)
25
26
val mapping = Map (
26
- " \\ {\\ { path \\ }\\ }" .r -> pathToString(path) ,
27
+ " \\ {\\ { path \\ }\\ }" .r -> pathString ,
27
28
" \\ {\\ { line \\ }\\ }" .r -> line.fold(" " )(_.toString),
28
29
" \\ {\\ { ext \\ }\\ }" .r -> Some (
29
- pathToString(path) ).filter(_.lastIndexOf(" ." ) == - 1 ).fold(" " )(p => p.substring(p.lastIndexOf(" ." ))
30
+ pathString ).filter(_.lastIndexOf(" ." ) == - 1 ).fold(" " )(p => p.substring(p.lastIndexOf(" ." ))
30
31
),
31
32
" \\ {\\ { path_no_ext \\ }\\ }" .r -> Some (
32
- pathToString(path)) .filter(_.lastIndexOf(" ." ) == - 1 ).fold(pathToString(path) )(p => p.substring(0 , p.lastIndexOf(" ." ))
33
+ pathString) .filter(_.lastIndexOf(" ." ) == - 1 ).fold(pathString )(p => p.substring(0 , p.lastIndexOf(" ." ))
33
34
),
34
35
" \\ {\\ { name \\ }\\ }" .r -> memberName
35
36
)
@@ -43,7 +44,7 @@ case class WebBasedSourceLink(prefix: String, revision: String, subPath: String)
43
44
override def render (memberName : String , path : Path , operation : String , line : Option [Int ]): String =
44
45
val action = if operation == " view" then " blob" else operation
45
46
val linePart = line.fold(" " )(l => s " #L $l" )
46
- s " $prefix/ $action/ $revision$subPath/ $path$linePart"
47
+ s " $prefix/ $action/ $revision$subPath/ ${pathToString( path)} $linePart"
47
48
48
49
object SourceLink :
49
50
val SubPath = " ([^=]+)=(.+)" .r
0 commit comments