Skip to content

Backport ci fixes #12895

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
Jun 22, 2021
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/blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>{{ page.title }}</h1>
{% for post in site.posts %}
<li>
<h2>
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
<a href="{{ post.url }}">{{ post.title }}</a>
</h2>
<div class="byline">
<time class="date">
Expand Down
8 changes: 7 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,13 @@ object Build {
// TODO add versions etc.
def srcManaged(v: String, s: String) = s"out/bootstrap/stdlib-bootstrapped/scala-$v/src_managed/main/$s-library-src"
def scalaSrcLink(v: String, s: String) = s"-source-links:$s=github://scala/scala/v$v#src/library"
def dottySrcLink(v: String, s: String) = s"-source-links:$s=github://lampepfl/dotty/$v#library/src"
def dottySrcLink(v: String, s: String) =
sys.env.get("GITHUB_SHA") match {
case Some(sha) =>
s"-source-links:$s=github://${sys.env("GITHUB_REPOSITORY")}/$sha#library/src"
case None => s"-source-links:$s=github://lampepfl/dotty/$v#library/src"
}

val revision = Seq("-revision", ref, "-project-version", projectVersion)
val cmd = Seq(
"-d",
Expand Down
17 changes: 10 additions & 7 deletions scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,16 @@ class StaticSiteContext(
if link.startsWith("/") then root.toPath.resolve(link.drop(1))
else template.file.toPath.getParent().resolve(link).normalize()

baseFile.getFileName.toString.split("\\.").headOption.toSeq.flatMap { baseFileName =>
Seq(
Some(baseFile.resolveSibling(baseFileName + ".html")),
Some(baseFile.resolveSibling(baseFileName + ".md")),
Option.when(baseFileName == "index")(baseFile.getParent)
).flatten.filter(Files.exists(_)).map(driFor)
}
val fileName = baseFile.getFileName.toString
val baseFileName = if fileName.endsWith(".md")
then fileName.stripSuffix(".md")
else fileName.stripSuffix(".html")

Seq(
Some(baseFile.resolveSibling(baseFileName + ".html")),
Some(baseFile.resolveSibling(baseFileName + ".md")),
Option.when(baseFileName == "index")(baseFile.getParent)
).flatten.filter(Files.exists(_)).map(driFor)
}.toOption.filter(_.nonEmpty)
pathsDri.getOrElse(memberLinkResolver(link).toList)

Expand Down
14 changes: 14 additions & 0 deletions scaladoc/test-documentations/static-links/docs/Adoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Adoc
---
# Header in Adoc

[A link to](dir/html.md)
[A link to](dir/name...with..dots..md)
[A link to](dir/name.with.md.and.html.md)
[A link to](dir/nested.md)
[A link to](dir/nested.svg)



And a text!
5 changes: 5 additions & 0 deletions scaladoc/test-documentations/static-links/docs/dir/html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: html named file
---

And a text!
6 changes: 6 additions & 0 deletions scaladoc/test-documentations/static-links/docs/dir/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: A directory
---
# {{ page.title }}

And a text!
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Strange name multipke dots in nane
---

And a text!
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: name.with.md.and.html
---

And a text!
6 changes: 6 additions & 0 deletions scaladoc/test-documentations/static-links/docs/dir/nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Nested in a directory
---
# {{ page.title }}

And a text!
54 changes: 54 additions & 0 deletions scaladoc/test-documentations/static-links/docs/dir/nested.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions scaladoc/test-documentations/static-links/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# {{ page.title }} in header

And a text!
Loading