diff --git a/docs/_docs/reference/other-new-features/other-new-types.md b/docs/_docs/reference/other-new-features/other-new-features.md similarity index 100% rename from docs/_docs/reference/other-new-features/other-new-types.md rename to docs/_docs/reference/other-new-features/other-new-features.md diff --git a/docs/sidebar.yml b/docs/sidebar.yml index 95786121e8f4..e3d496822003 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -69,7 +69,7 @@ subsection: - page: reference/metaprogramming/reflection.md - page: reference/metaprogramming/tasty-inspect.md - title: Other New Features - index: reference/other-new-features/other-new-types.md + index: reference/other-new-features/other-new-features.md subsection: - page: reference/other-new-features/trait-parameters.md - page: reference/other-new-features/transparent-traits.md diff --git a/project/Build.scala b/project/Build.scala index a581cd26aa38..16f45f50befb 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1381,21 +1381,33 @@ object Build { generateDocumentation(Testcases) }.value, + // Generate the Scala 3 reference documentation (published at https://docs.scala-lang.org/scala3/reference) generateReferenceDocumentation := Def.inputTaskDyn { val shouldRegenerateExpectedLinks = (Space ~> literal("--no-regenerate-expected-links")).?.parsed.isEmpty generateStaticAssetsTask.value + // Move all the source files to a temporary directory and apply some changes specific to the reference documentation val temp = IO.createTemporaryDirectory IO.copyDirectory(file("docs"), temp / "docs") IO.delete(temp / "docs" / "_blog") + // Overwrite the main layout and the sidebar IO.copyDirectory( file("project") / "resources" / "referenceReplacements", temp / "docs", overwrite = true ) + // Add redirections from previously supported URLs, for some pages + for (name <- Seq("changed-features", "contextual", "dropped-features", "metaprogramming", "other-new-features")) { + val path = temp / "docs" / "_docs" / "reference" / name / s"${name}.md" + val contentLines = IO.read(path).linesIterator.to[collection.mutable.ArrayBuffer] + contentLines.insert(1, s"redirectFrom: /${name}.html") // Add redirection + val newContent = contentLines.mkString("\n") + IO.write(path, newContent) + } + val languageReferenceConfig = Def.task { Scala3.value .add(OutputDir("scaladoc/output/reference")) diff --git a/project/resources/referenceReplacements/sidebar.yml b/project/resources/referenceReplacements/sidebar.yml index 680b44d353d4..a9a4d23c869f 100644 --- a/project/resources/referenceReplacements/sidebar.yml +++ b/project/resources/referenceReplacements/sidebar.yml @@ -49,7 +49,7 @@ subsection: - page: reference/metaprogramming/reflection.md - page: reference/metaprogramming/tasty-inspect.md - title: Other New Features - index: reference/other-new-features/other-new-types.md + index: reference/other-new-features/other-new-features.md subsection: - page: reference/other-new-features/trait-parameters.md - page: reference/other-new-features/transparent-traits.md