@@ -6,7 +6,7 @@ import dotty.dokka.model.api._
66import dotty .tools .dotc .core .Contexts .Context
77import scala .util .matching .Regex
88
9- def pathToString (p : Path ) = " / " + p.toString.replace('\\ ' , '/' )
9+ def pathToString (p : Path ) = p.toString.replace('\\ ' , '/' )
1010
1111trait SourceLink :
1212 val path : Option [Path ] = None
@@ -22,14 +22,15 @@ case class PrefixedSourceLink(val myPath: Path, nested: SourceLink) extends Sour
2222case class TemplateSourceLink (val urlTemplate : String ) extends SourceLink :
2323 override val path : Option [Path ] = None
2424 override def render (memberName : String , path : Path , operation : String , line : Option [Int ]): String =
25+ val pathString = " /" + pathToString(path)
2526 val mapping = Map (
26- " \\ {\\ { path \\ }\\ }" .r -> pathToString(path) ,
27+ " \\ {\\ { path \\ }\\ }" .r -> pathString ,
2728 " \\ {\\ { line \\ }\\ }" .r -> line.fold(" " )(_.toString),
2829 " \\ {\\ { 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(" ." ))
3031 ),
3132 " \\ {\\ { 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(" ." ))
3334 ),
3435 " \\ {\\ { name \\ }\\ }" .r -> memberName
3536 )
@@ -43,7 +44,7 @@ case class WebBasedSourceLink(prefix: String, revision: String, subPath: String)
4344 override def render (memberName : String , path : Path , operation : String , line : Option [Int ]): String =
4445 val action = if operation == " view" then " blob" else operation
4546 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"
4748
4849object SourceLink :
4950 val SubPath = " ([^=]+)=(.+)" .r
0 commit comments