Skip to content

Commit e17894e

Browse files
committed
Alternative implementation that alters only the documentation published to docs.scala-lang.org/scala3/reference
1 parent 8554cf4 commit e17894e

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

docs/_docs/reference/changed-features/changed-features.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
layout: index
33
title: "Other Changed Features"
44
movedTo: https://docs.scala-lang.org/scala3/reference/changed-features.html
5-
redirectFrom: /changed-features.html
65
---
76

87
The following pages document the features that have changed in Scala 3, compared to Scala 2.

docs/_docs/reference/contextual/contextual.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
layout: index
33
title: "Contextual Abstractions"
44
movedTo: https://docs.scala-lang.org/scala3/reference/contextual.html
5-
redirectFrom: /contextual.html
65
---
76

87
### Critique of the Status Quo

docs/_docs/reference/dropped-features/dropped-features.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
layout: index
33
title: "Dropped Features"
44
movedTo: https://docs.scala-lang.org/scala3/reference/dropped-features.html
5-
redirectFrom: /dropped-features.html
65
---
76

87
The following pages document the features of Scala 2 that have been dropped in Scala 3.

docs/_docs/reference/metaprogramming/metaprogramming.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
layout: index
33
title: "Metaprogramming"
44
movedTo: https://docs.scala-lang.org/scala3/reference/metaprogramming.html
5-
redirectFrom: /metaprogramming.html
65
---
76

87
The following pages introduce the redesign of metaprogramming in Scala. They

docs/_docs/reference/other-new-features/other-new-features.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
layout: index
33
title: "Other New Features"
44
movedTo: https://docs.scala-lang.org/scala3/reference/other-new-features.html
5-
redirectFrom: /other-new-features.html
65
---
76

87
The following pages document new features of Scala 3.

project/Build.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,21 +1381,33 @@ object Build {
13811381
generateDocumentation(Testcases)
13821382
}.value,
13831383

1384+
// Generate the Scala 3 reference documentation (published at https://docs.scala-lang.org/scala3/reference)
13841385
generateReferenceDocumentation := Def.inputTaskDyn {
13851386
val shouldRegenerateExpectedLinks = (Space ~> literal("--no-regenerate-expected-links")).?.parsed.isEmpty
13861387

13871388
generateStaticAssetsTask.value
13881389

1390+
// Move all the source files to a temporary directory and apply some changes specific to the reference documentation
13891391
val temp = IO.createTemporaryDirectory
13901392
IO.copyDirectory(file("docs"), temp / "docs")
13911393
IO.delete(temp / "docs" / "_blog")
13921394

1395+
// Overwrite the main layout and the sidebar
13931396
IO.copyDirectory(
13941397
file("project") / "resources" / "referenceReplacements",
13951398
temp / "docs",
13961399
overwrite = true
13971400
)
13981401

1402+
// Add redirections from previously supported URLs, for some pages
1403+
for (name <- Seq("changed-features", "contextual", "dropped-features", "metaprogramming", "other-new-features")) {
1404+
val path = temp / "docs" / "_docs" / "reference" / name / s"${name}.md"
1405+
val contentLines = IO.read(path).linesIterator.to[collection.mutable.ArrayBuffer]
1406+
contentLines.insert(1, s"redirectFrom: /${name}.html") // Add redirection
1407+
val newContent = contentLines.mkString("\n")
1408+
IO.write(path, newContent)
1409+
}
1410+
13991411
val languageReferenceConfig = Def.task {
14001412
Scala3.value
14011413
.add(OutputDir("scaladoc/output/reference"))

0 commit comments

Comments
 (0)