Skip to content

Commit 126fffc

Browse files
Backport "Fix link resolving in scaladoc and fix invalid links in docs" to LTS (#20603)
Backports #18465 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 939d06f + b7e118c commit 126fffc

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

docs/_docs/contributing/architecture/types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ format corresponding to the backing data structure, e.g. `ExprType(...)`
1111
corresponds to `class ExprType`, defined in [Types.scala].
1212

1313
> You can inspect the representation of any type using the [dotty.tools.printTypes][DottyTypeStealer]
14-
> script, its usage and integration into your debugging workflow is [described here](../issues/inspection.md).
14+
> script, its usage and integration into your debugging workflow is [described here](../debugging/inspection.md).
1515
1616
### Types of Definitions
1717

docs/_docs/contributing/debugging/debugging.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ that you're having issues with. This can be just inspecting the trees of your
99
code or stepping through the dotty codebase with a Debugger.
1010

1111
The following sections will help you with this:
12-
- [Debugging with your IDE](./ide-debugging.md.md)
12+
- [Debugging with your IDE](./ide-debugging.md)
1313
- [How to Inspect Values](./inspection.md)
1414
- [Other Debugging Techniques](./other-debugging.md)

docs/_docs/contributing/issues/cause.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This flag forces a stack trace to be printed each time an error happens, from th
6969
Analysing the trace will give you a clue about the objects involved in producing
7070
the error. For example, you can add some debug statements before the error is
7171
issued to discover the state of the compiler. [See some useful ways to debug
72-
values.](./debugging/inspection.md)
72+
values.](../debugging/inspection.md)
7373

7474
### Where was a particular object created?
7575

docs/_docs/contributing/issues/reproduce.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ not be passed). This saves typing the same arguments each time you want to use t
133133
134134
The following `launch.iss` file is an example of how you can use multiline
135135
commands as a template for solving issues that [run compiled
136-
code](../issues/testing.md#checking-program-output). It demonstrates configuring
136+
code](../testing.md#checking-program-output). It demonstrates configuring
137137
the `scala3/scalac` command using compiler flags, which are commented out. Put
138138
your favourite flags there for quick usage.
139139

scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala

+9-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ trait SiteRenderer(using DocContext) extends Locations:
2929

3030
def siteContent(pageDri: DRI, content: ResolvedTemplate): PageContent =
3131
import content.ctx
32+
33+
def tryAsDriPlain(str: String): Option[String] =
34+
val (path, prefix) = str match
35+
case HashRegex(path, prefix) => (path, prefix)
36+
case _ => (str, "")
37+
val res = ctx.driForLink(content.template.file, path).filter(driExists)
38+
res.headOption.map(pathToPage(pageDri, _) + prefix)
39+
3240
def tryAsDri(str: String): Option[String] =
3341
val newStr =
3442
str.dropWhile(c => c == '.' || c == '/').replaceAll("/", ".") match
@@ -51,7 +59,7 @@ trait SiteRenderer(using DocContext) extends Locations:
5159
)(
5260
resolveLink(pageDri, str.stripPrefix("/"))
5361
)
54-
def asStaticSite: Option[String] = tryAsDri(str)
62+
def asStaticSite: Option[String] = tryAsDriPlain(str).orElse(tryAsDri(str))
5563

5664
/* Link resolving checks performs multiple strategies with following priority:
5765
1. We check if the link is a valid URL e.g. http://dotty.epfl.ch

0 commit comments

Comments
 (0)