@@ -10,7 +10,6 @@ import java.nio.file.Paths
1010import org .jetbrains .dokka .base .parsers .MarkdownParser
1111import org .jetbrains .dokka .base .transformers .pages .comments .DocTagToContentConverter
1212import org .jetbrains .dokka .DokkaConfiguration
13- import org .jetbrains .dokka .links .DRI
1413import org .jetbrains .dokka .model .doc .{DocTag , Text }
1514import org .jetbrains .dokka .model .properties .PropertyContainer
1615import org .jetbrains .dokka .pages .{ContentKind , ContentNode , DCI , PageNode }
@@ -23,6 +22,8 @@ import scala.collection.JavaConverters._
2322
2423class StaticSiteContext (val root : File , sourceSets : Set [SourceSetWrapper ]):
2524
25+ var memberLinkResolver : String => Option [DRI ] = _ => None
26+
2627 def indexPage (): Option [StaticPageNode ] =
2728 val files = List (new File (root, " index.html" ), new File (root, " index.md" )).filter { _.exists() }
2829 // TODO (https://github.com/lampepfl/scala3doc/issues/238): provide proper error handling
@@ -127,10 +128,14 @@ class StaticSiteContext(val root: File, sourceSets: Set[SourceSetWrapper]):
127128 dir(" docs" ).flatMap(_.listFiles()).flatMap(loadTemplate(_, isBlog = false ))
128129 ++ dir(" blog" ).flatMap(loadTemplate(_, isBlog = true ))
129130
130- def driForLink (template : TemplateFile , link : String ): Try [DRI ] = Try (driFor(
131+ def driForLink (template : TemplateFile , link : String ): Option [DRI ] =
132+ val pathDri = Try {
133+ val path =
131134 if link.startsWith(" /" ) then root.toPath.resolve(link.drop(1 ))
132135 else template.file.toPath.getParent().resolve(link)
133- ))
136+ if Files .exists(path) then Some (driFor(path)) else None
137+ }.toOption.flatten
138+ pathDri.orElse(memberLinkResolver(link))
134139
135140 def driFor (dest : Path ): DRI = mkDRI(s " _. ${root.toPath.relativize(dest)}" )
136141
0 commit comments