Skip to content

Fix link resolving in scaladoc and fix invalid links in docs #18465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/_docs/contributing/architecture/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ format corresponding to the backing data structure, e.g. `ExprType(...)`
corresponds to `class ExprType`, defined in [Types.scala].

> You can inspect the representation of any type using the [dotty.tools.printTypes][DottyTypeStealer]
> script, its usage and integration into your debugging workflow is [described here](../issues/inspection.md).
> script, its usage and integration into your debugging workflow is [described here](../debugging/inspection.md).

### Types of Definitions

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/contributing/debugging/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ that you're having issues with. This can be just inspecting the trees of your
code or stepping through the dotty codebase with a Debugger.

The following sections will help you with this:
- [Debugging with your IDE](./ide-debugging.md.md)
- [Debugging with your IDE](./ide-debugging.md)
- [How to Inspect Values](./inspection.md)
- [Other Debugging Techniques](./other-debugging.md)
2 changes: 1 addition & 1 deletion docs/_docs/contributing/issues/cause.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This flag forces a stack trace to be printed each time an error happens, from th
Analysing the trace will give you a clue about the objects involved in producing
the error. For example, you can add some debug statements before the error is
issued to discover the state of the compiler. [See some useful ways to debug
values.](./debugging/inspection.md)
values.](../debugging/inspection.md)

### Where was a particular object created?

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/contributing/issues/reproduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ not be passed). This saves typing the same arguments each time you want to use t

The following `launch.iss` file is an example of how you can use multiline
commands as a template for solving issues that [run compiled
code](../issues/testing.md#checking-program-output). It demonstrates configuring
code](../testing.md#checking-program-output). It demonstrates configuring
the `scala3/scalac` command using compiler flags, which are commented out. Put
your favourite flags there for quick usage.

Expand Down
10 changes: 9 additions & 1 deletion scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ trait SiteRenderer(using DocContext) extends Locations:

def siteContent(pageDri: DRI, content: ResolvedTemplate): PageContent =
import content.ctx

def tryAsDriPlain(str: String): Option[String] =
val (path, prefix) = str match
case HashRegex(path, prefix) => (path, prefix)
case _ => (str, "")
val res = ctx.driForLink(content.template.file, path).filter(driExists)
res.headOption.map(pathToPage(pageDri, _) + prefix)

def tryAsDri(str: String): Option[String] =
val newStr =
str.dropWhile(c => c == '.' || c == '/').replaceAll("/", ".") match
Expand All @@ -51,7 +59,7 @@ trait SiteRenderer(using DocContext) extends Locations:
)(
resolveLink(pageDri, str.stripPrefix("/"))
)
def asStaticSite: Option[String] = tryAsDri(str)
def asStaticSite: Option[String] = tryAsDriPlain(str).orElse(tryAsDri(str))

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