Skip to content

Static site bugfixes found in stable documentation #15131

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
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
1 change: 0 additions & 1 deletion .github/workflows/language-reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
uses: actions/checkout@v3
with:
path: 'dotty'
ref: 'language-reference-stable'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means that when the action will be executed on a PR, it will checkout the branch of that PR, and when it will be executed on the branch language-reference-stable (by cron) that branch will be checked out, right?

fetch-depth: 0
ssh-key: ${{ secrets.DOCS_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ object Build {
.add(ProjectVersion("3.1.2")) // TODO: Change that later to the current version tag. (This must happen on first forward this branch to stable release tag)
.remove[VersionsDictionaryUrl]
.add(SourceLinks(List(
dottySrcLink(referenceVersion, temp.getAbsolutePath + "=")
dottySrcLink("language-reference-stable", temp.getAbsolutePath + "=")
)))
.withTargets(List("___fake___.scala"))
}
Expand Down
2 changes: 1 addition & 1 deletion project/scripts/docsLinksStability
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXPECTED_LINKS_FILE=$2 # The location of expected-links.txt is passed as a secon

pushd $DOCS_DIR > /dev/null # Go to docs dir but remember previous location
# We need to go to docs dir to make find return correct relative paths
find . -type f -name "*.html" | sort | (popd > /dev/null; diff $EXPECTED_LINKS_FILE -;)
find . -type f -name "*.html" | LC_ALL=C sort | (popd > /dev/null; diff $EXPECTED_LINKS_FILE -;)
# We list every html file in documentation, then sort it and finally compare to the expected links list.
# Before running diff we need to popd to return to the previous location because we don't have relative path to the expected links file.

Expand Down
40 changes: 20 additions & 20 deletions project/scripts/expected-links/reference-expected-links.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
./changed-features.html
./changed-features/compiler-plugins.html
./changed-features/eta-expansion.html
./changed-features/eta-expansion-spec.html
./changed-features.html
./changed-features/implicit-conversions.html
./changed-features/eta-expansion.html
./changed-features/implicit-conversions-spec.html
./changed-features/implicit-conversions.html
./changed-features/implicit-resolution.html
./changed-features/imports.html
./changed-features/index.html
Expand All @@ -15,23 +15,23 @@
./changed-features/overload-resolution.html
./changed-features/pattern-bindings.html
./changed-features/pattern-matching.html
./changed-features/structural-types.html
./changed-features/structural-types-spec.html
./changed-features/structural-types.html
./changed-features/type-checking.html
./changed-features/type-inference.html
./changed-features/vararg-splices.html
./changed-features/wildcards.html
./contextual.html
./contextual/by-name-context-parameters.html
./contextual/context-bounds.html
./contextual/context-functions.html
./contextual/context-functions-spec.html
./contextual/context-functions.html
./contextual/conversions.html
./contextual/derivation.html
./contextual/derivation-macro.html
./contextual/derivation.html
./contextual/extension-methods.html
./contextual/given-imports.html
./contextual/givens.html
./contextual.html
./contextual/index.html
./contextual/multiversal-equality.html
./contextual/relationship-implicits.html
Expand All @@ -40,14 +40,14 @@
./contextual/using-clauses.html
./docs/reference/other-new-features/named-typeargs.html
./docsScalaLangResources/scaladoc-assets.html
./dropped-features.html
./dropped-features/auto-apply.html
./dropped-features/class-shadowing.html
./dropped-features/class-shadowing-spec.html
./dropped-features/class-shadowing.html
./dropped-features/delayed-init.html
./dropped-features/do-while.html
./dropped-features/early-initializers.html
./dropped-features/existential-types.html
./dropped-features.html
./dropped-features/index.html
./dropped-features/limit22.html
./dropped-features/macros.html
Expand All @@ -57,8 +57,8 @@
./dropped-features/symlits.html
./dropped-features/this-qualifier.html
./dropped-features/type-projection.html
./dropped-features/weak-conformance.html
./dropped-features/weak-conformance-spec.html
./dropped-features/weak-conformance.html
./dropped-features/wildcard-init.html
./dropped-features/xml.html
./enums/adts.html
Expand All @@ -67,54 +67,54 @@
./enums/index.html
./experimental/canthrow.html
./experimental/cc.html
./experimental/erased-defs.html
./experimental/erased-defs-spec.html
./experimental/erased-defs.html
./experimental/explicit-nulls.html
./experimental/index.html
./experimental/main-annotation.html
./experimental/named-typeargs.html
./experimental/named-typeargs-spec.html
./experimental/named-typeargs.html
./experimental/numeric-literals.html
./experimental/overview.html
./features-classification.html
./index.html
./language-versions/binary-compatibility.html
./language-versions/index.html
./language-versions/source-compatibility.html
./metaprogramming/compiletime-ops.html
./metaprogramming.html
./metaprogramming/compiletime-ops.html
./metaprogramming/index.html
./metaprogramming/inline.html
./metaprogramming/macros.html
./metaprogramming/macros-spec.html
./metaprogramming/macros.html
./metaprogramming/reflection.html
./metaprogramming/staging.html
./metaprogramming/tasty-inspect.html
./new-types/dependent-function-types.html
./new-types/dependent-function-types-spec.html
./new-types/dependent-function-types.html
./new-types/index.html
./new-types/intersection-types.html
./new-types/intersection-types-spec.html
./new-types/intersection-types.html
./new-types/match-types.html
./new-types/polymorphic-function-types.html
./new-types/type-lambdas.html
./new-types/type-lambdas-spec.html
./new-types/union-types.html
./new-types/type-lambdas.html
./new-types/union-types-spec.html
./new-types/union-types.html
./other-new-features.html
./other-new-features/control-syntax.html
./other-new-features/creator-applications.html
./other-new-features/experimental-defs.html
./other-new-features/export.html
./other-new-features.html
./other-new-features/indentation.html
./other-new-features/index.html
./other-new-features/kind-polymorphism.html
./other-new-features/matchable.html
./other-new-features/opaques-details.html
./other-new-features/opaques.html
./other-new-features/open-classes.html
./other-new-features/parameter-untupling.html
./other-new-features/parameter-untupling-spec.html
./other-new-features/parameter-untupling.html
./other-new-features/safe-initialization.html
./other-new-features/targetName.html
./other-new-features/threadUnsafe-annotation.html
Expand Down
2 changes: 1 addition & 1 deletion project/scripts/regenerateExpectedLinks
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXPECTED_LINKS_FILE=$2 # The location of expected-links.txt is passed as a secon

pushd $DOCS_DIR > /dev/null # Go to docs dir but remember previous location
# We need to go to docs dir to make find return correct relative paths
find . -type f -name "*.html" | (popd > /dev/null; sort > $2;)
find . -type f -name "*.html" | (popd > /dev/null; LC_ALL=C sort > $2;)
# We list every html file in documentation, then sort it and finally write it to the expected links list file.
# Before writing we need to popd to return to the previous location because we don't have relative path to the expected links file.

4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/DocContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ case class DocContext(args: Scaladoc.Args, compilerContext: CompilerContext):
report.warning(
s"""Following generated file paths might not be compatible with Jekyll:
|${jekyllIncompatLinks.mkString("\n")}
|If using GitHub Pages consider adding a \".nojekyll\" file.
""".stripMargin)(using compilerContext)
|If using GitHub Pages consider adding a \".nojekyll\" file.""".stripMargin
)(using compilerContext)
10 changes: 6 additions & 4 deletions scaladoc/src/dotty/tools/scaladoc/PathBased.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import java.nio.file.{Path, Paths}

case class PathBased[T](entries: List[PathBased.Entry[T]], projectRoot: Path):
def get(path: Path): Option[PathBased.Result[T]] =
if path.isAbsolute && path.startsWith(projectRoot) then get(projectRoot.relativize(path))
else entries.filter(_.path.forall(p => path.startsWith(p))).maxByOption(_.path.map(_.toString.length)).map(entry =>
PathBased.Result(entry.path.fold(path)(_.relativize(path)), entry.elem)
)
val paths = Option.when(path.isAbsolute && path.startsWith(projectRoot))(projectRoot.relativize(path)).toSeq :+ path
paths.iterator.to(LazyList).flatMap { path =>
entries.filter(_.path.forall(p => path.startsWith(p))).maxByOption(_.path.map(_.toString.length)).map(entry =>
PathBased.Result(entry.path.fold(path)(_.relativize(path)), entry.elem)
)
}.headOption

trait ArgParser[T]:
def parse(s: String): Either[String, T]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do
footer(
div(id := "generated-by")(
span(cls := "footer-text")(raw("Generated by")),
a(href := "https://github.com/lampepfl/dotty/tree/master/scaladoc")(
a(href := "https://github.com/lampepfl/dotty/tree/main/scaladoc")(
img(
src := resolveRoot(link.dri, "images/scaladoc_logo.svg"),
alt := "scaladoc",
Expand Down
8 changes: 3 additions & 5 deletions scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ case class LoadedTemplate(
val subpages = children.filterNot(_.hidden).map(_.lazyTemplateProperties(ctx))
def getMap(key: String) = templateFile.settings.getOrElse(key, Map.empty).asInstanceOf[Map[String, Object]]

val sourceLinks = if !file.exists() then Nil else
// TODO (https://github.com/lampepfl/scala3doc/issues/240): configure source root
// toRealPath is used to turn symlinks into proper paths
val actualPath = Paths.get("").toAbsolutePath.relativize(file.toPath.toRealPath())
val sourceLinks = if !templateFile.file.exists() then Nil else
val actualPath = templateFile.file.toPath
ctx.sourceLinks.pathTo(actualPath).map("viewSource" -> _ ) ++
ctx.sourceLinks.pathTo(actualPath, operation = "edit", optionalRevision = Some("master")).map("editSource" -> _)
ctx.sourceLinks.pathTo(actualPath, operation = "edit").map("editSource" -> _)

val updatedSettings = templateFile.settings ++ ctx.projectWideProperties +
("site" -> (getMap("site") + ("subpages" -> subpages))) + ("urls" -> sourceLinks.toMap) +
Expand Down