diff --git a/docs/css/bootstrap.min.css b/docs/_assets/css/bootstrap.min.css similarity index 100% rename from docs/css/bootstrap.min.css rename to docs/_assets/css/bootstrap.min.css diff --git a/docs/css/color-brewer.css b/docs/_assets/css/color-brewer.css similarity index 100% rename from docs/css/color-brewer.css rename to docs/_assets/css/color-brewer.css diff --git a/docs/css/dottydoc.css b/docs/_assets/css/dottydoc.css similarity index 100% rename from docs/css/dottydoc.css rename to docs/_assets/css/dottydoc.css diff --git a/docs/css/frontpage.css b/docs/_assets/css/frontpage.css similarity index 100% rename from docs/css/frontpage.css rename to docs/_assets/css/frontpage.css diff --git a/docs/css/search.css b/docs/_assets/css/search.css similarity index 100% rename from docs/css/search.css rename to docs/_assets/css/search.css diff --git a/docs/css/sidebar.css b/docs/_assets/css/sidebar.css similarity index 100% rename from docs/css/sidebar.css rename to docs/_assets/css/sidebar.css diff --git a/docs/css/toolbar.css b/docs/_assets/css/toolbar.css similarity index 100% rename from docs/css/toolbar.css rename to docs/_assets/css/toolbar.css diff --git a/docs/docsScalaLangResources/scaladoc-assets.html b/docs/_assets/docsScalaLangResources/scaladoc-assets.html similarity index 100% rename from docs/docsScalaLangResources/scaladoc-assets.html rename to docs/_assets/docsScalaLangResources/scaladoc-assets.html diff --git a/docs/images/aggelos.jpg b/docs/_assets/images/aggelos.jpg similarity index 100% rename from docs/images/aggelos.jpg rename to docs/_assets/images/aggelos.jpg diff --git a/docs/images/allan.jpg b/docs/_assets/images/allan.jpg similarity index 100% rename from docs/images/allan.jpg rename to docs/_assets/images/allan.jpg diff --git a/docs/images/anatolii.png b/docs/_assets/images/anatolii.png similarity index 100% rename from docs/images/anatolii.png rename to docs/_assets/images/anatolii.png diff --git a/docs/images/dotty-ide/decompiler.png b/docs/_assets/images/dotty-ide/decompiler.png similarity index 100% rename from docs/images/dotty-ide/decompiler.png rename to docs/_assets/images/dotty-ide/decompiler.png diff --git a/docs/images/dotty-ide/documentation-hover.png b/docs/_assets/images/dotty-ide/documentation-hover.png similarity index 100% rename from docs/images/dotty-ide/documentation-hover.png rename to docs/_assets/images/dotty-ide/documentation-hover.png diff --git a/docs/images/dotty-ide/signature-help.png b/docs/_assets/images/dotty-ide/signature-help.png similarity index 100% rename from docs/images/dotty-ide/signature-help.png rename to docs/_assets/images/dotty-ide/signature-help.png diff --git a/docs/images/dotty-logo-white.svg b/docs/_assets/images/dotty-logo-white.svg similarity index 100% rename from docs/images/dotty-logo-white.svg rename to docs/_assets/images/dotty-logo-white.svg diff --git a/docs/images/explicit-nulls/explicit-nulls-type-hierarchy.png b/docs/_assets/images/explicit-nulls/explicit-nulls-type-hierarchy.png similarity index 100% rename from docs/images/explicit-nulls/explicit-nulls-type-hierarchy.png rename to docs/_assets/images/explicit-nulls/explicit-nulls-type-hierarchy.png diff --git a/docs/images/favicon.png b/docs/_assets/images/favicon.png similarity index 100% rename from docs/images/favicon.png rename to docs/_assets/images/favicon.png diff --git a/docs/images/felix.jpg b/docs/_assets/images/felix.jpg similarity index 100% rename from docs/images/felix.jpg rename to docs/_assets/images/felix.jpg diff --git a/docs/images/fengyun.jpg b/docs/_assets/images/fengyun.jpg similarity index 100% rename from docs/images/fengyun.jpg rename to docs/_assets/images/fengyun.jpg diff --git a/docs/images/github-logo.svg b/docs/_assets/images/github-logo.svg similarity index 100% rename from docs/images/github-logo.svg rename to docs/_assets/images/github-logo.svg diff --git a/docs/logo.svg b/docs/_assets/images/logo.svg similarity index 100% rename from docs/logo.svg rename to docs/_assets/images/logo.svg diff --git a/docs/images/martin.jpg b/docs/_assets/images/martin.jpg similarity index 100% rename from docs/images/martin.jpg rename to docs/_assets/images/martin.jpg diff --git a/docs/images/nico.jpg b/docs/_assets/images/nico.jpg similarity index 100% rename from docs/images/nico.jpg rename to docs/_assets/images/nico.jpg diff --git a/docs/images/olivier.jpg b/docs/_assets/images/olivier.jpg similarity index 100% rename from docs/images/olivier.jpg rename to docs/_assets/images/olivier.jpg diff --git a/docs/images/others/scala-days-logo.png b/docs/_assets/images/others/scala-days-logo.png similarity index 100% rename from docs/images/others/scala-days-logo.png rename to docs/_assets/images/others/scala-days-logo.png diff --git a/docs/images/petrashko.jpg b/docs/_assets/images/petrashko.jpg similarity index 100% rename from docs/images/petrashko.jpg rename to docs/_assets/images/petrashko.jpg diff --git a/docs/images/preview.png b/docs/_assets/images/preview.png similarity index 100% rename from docs/images/preview.png rename to docs/_assets/images/preview.png diff --git a/docs/images/scala-logo.svg b/docs/_assets/images/scala-logo.svg similarity index 100% rename from docs/images/scala-logo.svg rename to docs/_assets/images/scala-logo.svg diff --git a/docs/images/scaladoc-logo.png b/docs/_assets/images/scaladoc-logo.png similarity index 100% rename from docs/images/scaladoc-logo.png rename to docs/_assets/images/scaladoc-logo.png diff --git a/docs/images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif b/docs/_assets/images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif similarity index 100% rename from docs/images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif rename to docs/_assets/images/scaladoc/inkuire-1.0.0-M2_js_flatMap.gif diff --git a/docs/images/scaladoc/nightly.gif b/docs/_assets/images/scaladoc/nightly.gif similarity index 100% rename from docs/images/scaladoc/nightly.gif rename to docs/_assets/images/scaladoc/nightly.gif diff --git a/docs/images/smarter.jpg b/docs/_assets/images/smarter.jpg similarity index 100% rename from docs/images/smarter.jpg rename to docs/_assets/images/smarter.jpg diff --git a/docs/images/worksheets/config-autorun.png b/docs/_assets/images/worksheets/config-autorun.png similarity index 100% rename from docs/images/worksheets/config-autorun.png rename to docs/_assets/images/worksheets/config-autorun.png diff --git a/docs/images/worksheets/worksheet-demo.gif b/docs/_assets/images/worksheets/worksheet-demo.gif similarity index 100% rename from docs/images/worksheets/worksheet-demo.gif rename to docs/_assets/images/worksheets/worksheet-demo.gif diff --git a/docs/images/worksheets/worksheet-help.png b/docs/_assets/images/worksheets/worksheet-help.png similarity index 100% rename from docs/images/worksheets/worksheet-help.png rename to docs/_assets/images/worksheets/worksheet-help.png diff --git a/docs/images/worksheets/worksheet-run.png b/docs/_assets/images/worksheets/worksheet-run.png similarity index 100% rename from docs/images/worksheets/worksheet-run.png rename to docs/_assets/images/worksheets/worksheet-run.png diff --git a/docs/js/api-search.js b/docs/_assets/js/api-search.js similarity index 100% rename from docs/js/api-search.js rename to docs/_assets/js/api-search.js diff --git a/docs/js/bootstrap.min.js b/docs/_assets/js/bootstrap.min.js similarity index 100% rename from docs/js/bootstrap.min.js rename to docs/_assets/js/bootstrap.min.js diff --git a/docs/js/highlight.pack.js b/docs/_assets/js/highlight.pack.js similarity index 100% rename from docs/js/highlight.pack.js rename to docs/_assets/js/highlight.pack.js diff --git a/docs/js/jquery.min.js b/docs/_assets/js/jquery.min.js similarity index 100% rename from docs/js/jquery.min.js rename to docs/_assets/js/jquery.min.js diff --git a/docs/js/sidebar.js b/docs/_assets/js/sidebar.js similarity index 100% rename from docs/js/sidebar.js rename to docs/_assets/js/sidebar.js diff --git a/docs/js/toolbar.js b/docs/_assets/js/toolbar.js similarity index 100% rename from docs/js/toolbar.js rename to docs/_assets/js/toolbar.js diff --git a/docs/resources/safer-exceptions.pdf b/docs/_assets/resources/safer-exceptions.pdf similarity index 100% rename from docs/resources/safer-exceptions.pdf rename to docs/_assets/resources/safer-exceptions.pdf diff --git a/docs/blog/_posts/2015-10-23-dotty-compiler-bootstraps.md b/docs/_blog/_posts/2015-10-23-dotty-compiler-bootstraps.md similarity index 100% rename from docs/blog/_posts/2015-10-23-dotty-compiler-bootstraps.md rename to docs/_blog/_posts/2015-10-23-dotty-compiler-bootstraps.md diff --git a/docs/blog/_posts/2016-01-02-new-year-resolutions.md b/docs/_blog/_posts/2016-01-02-new-year-resolutions.md similarity index 100% rename from docs/blog/_posts/2016-01-02-new-year-resolutions.md rename to docs/_blog/_posts/2016-01-02-new-year-resolutions.md diff --git a/docs/blog/_posts/2016-02-03-essence-of-scala.md b/docs/_blog/_posts/2016-02-03-essence-of-scala.md similarity index 100% rename from docs/blog/_posts/2016-02-03-essence-of-scala.md rename to docs/_blog/_posts/2016-02-03-essence-of-scala.md diff --git a/docs/blog/_posts/2016-02-17-scaling-dot-soundness.md b/docs/_blog/_posts/2016-02-17-scaling-dot-soundness.md similarity index 100% rename from docs/blog/_posts/2016-02-17-scaling-dot-soundness.md rename to docs/_blog/_posts/2016-02-17-scaling-dot-soundness.md diff --git a/docs/blog/_posts/2016-05-05-multiversal-equality.md b/docs/_blog/_posts/2016-05-05-multiversal-equality.md similarity index 100% rename from docs/blog/_posts/2016-05-05-multiversal-equality.md rename to docs/_blog/_posts/2016-05-05-multiversal-equality.md diff --git a/docs/blog/_posts/2016-12-05-implicit-function-types.md b/docs/_blog/_posts/2016-12-05-implicit-function-types.md similarity index 100% rename from docs/blog/_posts/2016-12-05-implicit-function-types.md rename to docs/_blog/_posts/2016-12-05-implicit-function-types.md diff --git a/docs/blog/_posts/2017-05-31-first-dotty-milestone-release.md b/docs/_blog/_posts/2017-05-31-first-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2017-05-31-first-dotty-milestone-release.md rename to docs/_blog/_posts/2017-05-31-first-dotty-milestone-release.md diff --git a/docs/blog/_posts/2017-07-12-second-dotty-milestone-release.md b/docs/_blog/_posts/2017-07-12-second-dotty-milestone-release.md similarity index 98% rename from docs/blog/_posts/2017-07-12-second-dotty-milestone-release.md rename to docs/_blog/_posts/2017-07-12-second-dotty-milestone-release.md index 19de33740776..aa71d62ffc97 100644 --- a/docs/blog/_posts/2017-07-12-second-dotty-milestone-release.md +++ b/docs/_blog/_posts/2017-07-12-second-dotty-milestone-release.md @@ -10,7 +10,7 @@ Today, we are excited to release Dotty version 0.2.0-RC1. This release serves as a technology preview that demonstrates new language features and the compiler supporting them. -This release is based on the [previous milestone](/blog/_posts/2017-05-31-first-dotty-milestone-release.html). +This release is based on the [previous milestone](/_blog/_posts/2017-05-31-first-dotty-milestone-release.html). The highlights of this release are: - substantial improvement of quality of generated code for pattern matching - improvements in VS Code IDE stability @@ -24,7 +24,7 @@ The highlights of this release are: This is our second scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). ## What’s in the 0.2.0-RC1 technology preview? -The [previous technology preview](/blog/_posts/2017-05-31-first-dotty-milestone-release.html) has shipped new language features planned for Scala 3: +The [previous technology preview](/_blog/_posts/2017-05-31-first-dotty-milestone-release.html) has shipped new language features planned for Scala 3: [Intersection Types](https://dotty.epfl.ch/docs/reference/new-types/intersection-types.html), [Union Types](https://dotty.epfl.ch/docs/reference/new-types/union-types.html), [Trait Parameters](https://dotty.epfl.ch/docs/reference/other-new-features/trait-parameters.html), diff --git a/docs/blog/_posts/2017-09-07-third-dotty-milestone-release.md b/docs/_blog/_posts/2017-09-07-third-dotty-milestone-release.md similarity index 98% rename from docs/blog/_posts/2017-09-07-third-dotty-milestone-release.md rename to docs/_blog/_posts/2017-09-07-third-dotty-milestone-release.md index d07c5d518f19..eb20292884f1 100644 --- a/docs/blog/_posts/2017-09-07-third-dotty-milestone-release.md +++ b/docs/_blog/_posts/2017-09-07-third-dotty-milestone-release.md @@ -20,7 +20,7 @@ You can learn more about Dotty on our [website](http://dotty.epfl.ch). This is our third scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). -The [previous technology preview](/blog/_posts/2017-07-12-second-dotty-milestone-release.html) improved +The [previous technology preview](/_blog/_posts/2017-07-12-second-dotty-milestone-release.html) improved stability and reliability: - substantial improvement of quality of generated code for pattern matching diff --git a/docs/blog/_posts/2017-10-16-fourth-dotty-milestone-release.md b/docs/_blog/_posts/2017-10-16-fourth-dotty-milestone-release.md similarity index 98% rename from docs/blog/_posts/2017-10-16-fourth-dotty-milestone-release.md rename to docs/_blog/_posts/2017-10-16-fourth-dotty-milestone-release.md index 52a1f6914034..4990ec198aa0 100644 --- a/docs/blog/_posts/2017-10-16-fourth-dotty-milestone-release.md +++ b/docs/_blog/_posts/2017-10-16-fourth-dotty-milestone-release.md @@ -20,7 +20,7 @@ You can learn more about Dotty on our [website](http://dotty.epfl.ch). This is our fourth scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). -The [previous technology preview](/blog/_posts/2017-09-07-third-dotty-milestone-release.html) improved +The [previous technology preview](/_blog/_posts/2017-09-07-third-dotty-milestone-release.html) improved stability and reliability. ## What’s new in the 0.4.0-RC1 technology preview? diff --git a/docs/blog/_posts/2017-12-01-fifth-dotty-milestone-release.md b/docs/_blog/_posts/2017-12-01-fifth-dotty-milestone-release.md similarity index 98% rename from docs/blog/_posts/2017-12-01-fifth-dotty-milestone-release.md rename to docs/_blog/_posts/2017-12-01-fifth-dotty-milestone-release.md index 8204771b3134..98fa6e127088 100644 --- a/docs/blog/_posts/2017-12-01-fifth-dotty-milestone-release.md +++ b/docs/_blog/_posts/2017-12-01-fifth-dotty-milestone-release.md @@ -20,7 +20,7 @@ You can learn more about Dotty on our [website](http://dotty.epfl.ch). This is our fifth scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). -The [previous technology preview](/blog/_posts/2017-10-16-fourth-dotty-milestone-release.html) added +The [previous technology preview](/_blog/_posts/2017-10-16-fourth-dotty-milestone-release.html) added support for Scala 2.12 and came with a brand new REPL. ## What’s new in the 0.5.0-RC1 technology preview? diff --git a/docs/blog/_posts/2018-03-05-seventh-dotty-milestone-release.md b/docs/_blog/_posts/2018-03-05-seventh-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2018-03-05-seventh-dotty-milestone-release.md rename to docs/_blog/_posts/2018-03-05-seventh-dotty-milestone-release.md diff --git a/docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md b/docs/_blog/_posts/2018-04-27-eighth-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2018-04-27-eighth-dotty-milestone-release.md rename to docs/_blog/_posts/2018-04-27-eighth-dotty-milestone-release.md diff --git a/docs/blog/_posts/2018-07-06-ninth-dotty-milestone-release.md b/docs/_blog/_posts/2018-07-06-ninth-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2018-07-06-ninth-dotty-milestone-release.md rename to docs/_blog/_posts/2018-07-06-ninth-dotty-milestone-release.md diff --git a/docs/blog/_posts/2018-10-10-10th-dotty-milestone-release.md b/docs/_blog/_posts/2018-10-10-10th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2018-10-10-10th-dotty-milestone-release.md rename to docs/_blog/_posts/2018-10-10-10th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2018-11-30-11th-dotty-milestone-release.md b/docs/_blog/_posts/2018-11-30-11th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2018-11-30-11th-dotty-milestone-release.md rename to docs/_blog/_posts/2018-11-30-11th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-01-21-12th-dotty-milestone-release.md b/docs/_blog/_posts/2019-01-21-12th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-01-21-12th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-01-21-12th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-03-05-13th-dotty-milestone-release.md b/docs/_blog/_posts/2019-03-05-13th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-03-05-13th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-03-05-13th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-04-15-14th-dotty-milestone-release.md b/docs/_blog/_posts/2019-04-15-14th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-04-15-14th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-04-15-14th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-05-23-15th-dotty-milestone-release.md b/docs/_blog/_posts/2019-05-23-15th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-05-23-15th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-05-23-15th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-06-11-16th-dotty-milestone-release.md b/docs/_blog/_posts/2019-06-11-16th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-06-11-16th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-06-11-16th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-07-25-17th-dotty-milestone-release.md b/docs/_blog/_posts/2019-07-25-17th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-07-25-17th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-07-25-17th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-08-30-18th-dotty-milestone-release.md b/docs/_blog/_posts/2019-08-30-18th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-08-30-18th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-08-30-18th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-09-23-19th-dotty-milestone-release.md b/docs/_blog/_posts/2019-09-23-19th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-09-23-19th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-09-23-19th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-11-04-20th-dotty-milestone-release.md b/docs/_blog/_posts/2019-11-04-20th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-11-04-20th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-11-04-20th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-12-20-21th-dotty-milestone-release.md b/docs/_blog/_posts/2019-12-20-21th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2019-12-20-21th-dotty-milestone-release.md rename to docs/_blog/_posts/2019-12-20-21th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-02-05-22nd-dotty-milestone-release.md b/docs/_blog/_posts/2020-02-05-22nd-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-02-05-22nd-dotty-milestone-release.md rename to docs/_blog/_posts/2020-02-05-22nd-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-03-18-23rd-dotty-milestone-release.md b/docs/_blog/_posts/2020-03-18-23rd-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-03-18-23rd-dotty-milestone-release.md rename to docs/_blog/_posts/2020-03-18-23rd-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-04-29-24th-dotty-milestone-release.md b/docs/_blog/_posts/2020-04-29-24th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-04-29-24th-dotty-milestone-release.md rename to docs/_blog/_posts/2020-04-29-24th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-06-22-25th-dotty-milestone-release.md b/docs/_blog/_posts/2020-06-22-25th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-06-22-25th-dotty-milestone-release.md rename to docs/_blog/_posts/2020-06-22-25th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-07-27-26th-dotty-milestone-release.md b/docs/_blog/_posts/2020-07-27-26th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-07-27-26th-dotty-milestone-release.md rename to docs/_blog/_posts/2020-07-27-26th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-08-31-27th-dotty-milestone-release.md b/docs/_blog/_posts/2020-08-31-27th-dotty-milestone-release.md similarity index 100% rename from docs/blog/_posts/2020-08-31-27th-dotty-milestone-release.md rename to docs/_blog/_posts/2020-08-31-27th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2020-09-21-naming-schema-change.md b/docs/_blog/_posts/2020-09-21-naming-schema-change.md similarity index 100% rename from docs/blog/_posts/2020-09-21-naming-schema-change.md rename to docs/_blog/_posts/2020-09-21-naming-schema-change.md diff --git a/docs/blog/_posts/2020-11-09-scala3-m1.md b/docs/_blog/_posts/2020-11-09-scala3-m1.md similarity index 100% rename from docs/blog/_posts/2020-11-09-scala3-m1.md rename to docs/_blog/_posts/2020-11-09-scala3-m1.md diff --git a/docs/blog/_posts/2020-12-18-scala3-m3.md b/docs/_blog/_posts/2020-12-18-scala3-m3.md similarity index 100% rename from docs/blog/_posts/2020-12-18-scala3-m3.md rename to docs/_blog/_posts/2020-12-18-scala3-m3.md diff --git a/docs/blog/_posts/2021-02-17-scala3-rc1.md b/docs/_blog/_posts/2021-02-17-scala3-rc1.md similarity index 100% rename from docs/blog/_posts/2021-02-17-scala3-rc1.md rename to docs/_blog/_posts/2021-02-17-scala3-rc1.md diff --git a/docs/blog/_posts/2021-03-31-scala3-rc2.md b/docs/_blog/_posts/2021-03-31-scala3-rc2.md similarity index 100% rename from docs/blog/_posts/2021-03-31-scala3-rc2.md rename to docs/_blog/_posts/2021-03-31-scala3-rc2.md diff --git a/docs/blog/_posts/2021-04-21-scala3-rc3.md b/docs/_blog/_posts/2021-04-21-scala3-rc3.md similarity index 100% rename from docs/blog/_posts/2021-04-21-scala3-rc3.md rename to docs/_blog/_posts/2021-04-21-scala3-rc3.md diff --git a/docs/blog/_posts/2021-06-07-scala3.0.1-rc1-release.md b/docs/_blog/_posts/2021-06-07-scala3.0.1-rc1-release.md similarity index 100% rename from docs/blog/_posts/2021-06-07-scala3.0.1-rc1-release.md rename to docs/_blog/_posts/2021-06-07-scala3.0.1-rc1-release.md diff --git a/docs/blog/_posts/2021-06-25-scala301-rc2.md b/docs/_blog/_posts/2021-06-25-scala301-rc2.md similarity index 100% rename from docs/blog/_posts/2021-06-25-scala301-rc2.md rename to docs/_blog/_posts/2021-06-25-scala301-rc2.md diff --git a/docs/blog/index.html b/docs/_blog/index.html similarity index 100% rename from docs/blog/index.html rename to docs/_blog/index.html diff --git a/docs/docs/contributing/checklist.sh b/docs/_docs/contributing/checklist.sh similarity index 100% rename from docs/docs/contributing/checklist.sh rename to docs/_docs/contributing/checklist.sh diff --git a/docs/docs/contributing/contribute-knowledge.md b/docs/_docs/contributing/contribute-knowledge.md similarity index 100% rename from docs/docs/contributing/contribute-knowledge.md rename to docs/_docs/contributing/contribute-knowledge.md diff --git a/docs/docs/contributing/debug-tests.md b/docs/_docs/contributing/debug-tests.md similarity index 100% rename from docs/docs/contributing/debug-tests.md rename to docs/_docs/contributing/debug-tests.md diff --git a/docs/docs/contributing/debugging.md b/docs/_docs/contributing/debugging.md similarity index 100% rename from docs/docs/contributing/debugging.md rename to docs/_docs/contributing/debugging.md diff --git a/docs/docs/contributing/getting-started.md b/docs/_docs/contributing/getting-started.md similarity index 100% rename from docs/docs/contributing/getting-started.md rename to docs/_docs/contributing/getting-started.md diff --git a/docs/docs/contributing/procedures/release.md b/docs/_docs/contributing/procedures/release.md similarity index 100% rename from docs/docs/contributing/procedures/release.md rename to docs/_docs/contributing/procedures/release.md diff --git a/docs/docs/contributing/procedures/vulpix.md b/docs/_docs/contributing/procedures/vulpix.md similarity index 100% rename from docs/docs/contributing/procedures/vulpix.md rename to docs/_docs/contributing/procedures/vulpix.md diff --git a/docs/docs/contributing/scala2-vs-scala3.md b/docs/_docs/contributing/scala2-vs-scala3.md similarity index 100% rename from docs/docs/contributing/scala2-vs-scala3.md rename to docs/_docs/contributing/scala2-vs-scala3.md diff --git a/docs/docs/contributing/testing.md b/docs/_docs/contributing/testing.md similarity index 100% rename from docs/docs/contributing/testing.md rename to docs/_docs/contributing/testing.md diff --git a/docs/docs/contributing/tools/ide.md b/docs/_docs/contributing/tools/ide.md similarity index 100% rename from docs/docs/contributing/tools/ide.md rename to docs/_docs/contributing/tools/ide.md diff --git a/docs/docs/contributing/tools/mill.md b/docs/_docs/contributing/tools/mill.md similarity index 100% rename from docs/docs/contributing/tools/mill.md rename to docs/_docs/contributing/tools/mill.md diff --git a/docs/docs/contributing/tools/scalafix.md b/docs/_docs/contributing/tools/scalafix.md similarity index 100% rename from docs/docs/contributing/tools/scalafix.md rename to docs/_docs/contributing/tools/scalafix.md diff --git a/docs/docs/contributing/workflow.md b/docs/_docs/contributing/workflow.md similarity index 100% rename from docs/docs/contributing/workflow.md rename to docs/_docs/contributing/workflow.md diff --git a/docs/docs/index.md b/docs/_docs/index.md similarity index 100% rename from docs/docs/index.md rename to docs/_docs/index.md diff --git a/docs/docs/internals/backend.md b/docs/_docs/internals/backend.md similarity index 100% rename from docs/docs/internals/backend.md rename to docs/_docs/internals/backend.md diff --git a/docs/docs/internals/classpaths.md b/docs/_docs/internals/classpaths.md similarity index 100% rename from docs/docs/internals/classpaths.md rename to docs/_docs/internals/classpaths.md diff --git a/docs/docs/internals/contexts.md b/docs/_docs/internals/contexts.md similarity index 100% rename from docs/docs/internals/contexts.md rename to docs/_docs/internals/contexts.md diff --git a/docs/docs/internals/core-data-structures.md b/docs/_docs/internals/core-data-structures.md similarity index 100% rename from docs/docs/internals/core-data-structures.md rename to docs/_docs/internals/core-data-structures.md diff --git a/docs/docs/internals/debug-macros.md b/docs/_docs/internals/debug-macros.md similarity index 100% rename from docs/docs/internals/debug-macros.md rename to docs/_docs/internals/debug-macros.md diff --git a/docs/docs/internals/dotc-scalac.md b/docs/_docs/internals/dotc-scalac.md similarity index 100% rename from docs/docs/internals/dotc-scalac.md rename to docs/_docs/internals/dotc-scalac.md diff --git a/docs/docs/internals/dotty-internals-1-notes.md b/docs/_docs/internals/dotty-internals-1-notes.md similarity index 100% rename from docs/docs/internals/dotty-internals-1-notes.md rename to docs/_docs/internals/dotty-internals-1-notes.md diff --git a/docs/docs/internals/explicit-nulls.md b/docs/_docs/internals/explicit-nulls.md similarity index 100% rename from docs/docs/internals/explicit-nulls.md rename to docs/_docs/internals/explicit-nulls.md diff --git a/docs/docs/internals/higher-kinded-v2.md b/docs/_docs/internals/higher-kinded-v2.md similarity index 100% rename from docs/docs/internals/higher-kinded-v2.md rename to docs/_docs/internals/higher-kinded-v2.md diff --git a/docs/docs/internals/overall-structure.md b/docs/_docs/internals/overall-structure.md similarity index 100% rename from docs/docs/internals/overall-structure.md rename to docs/_docs/internals/overall-structure.md diff --git a/docs/docs/internals/periods.md b/docs/_docs/internals/periods.md similarity index 100% rename from docs/docs/internals/periods.md rename to docs/_docs/internals/periods.md diff --git a/docs/docs/internals/syntax-3.1.md b/docs/_docs/internals/syntax-3.1.md similarity index 100% rename from docs/docs/internals/syntax-3.1.md rename to docs/_docs/internals/syntax-3.1.md diff --git a/docs/docs/internals/syntax.md b/docs/_docs/internals/syntax.md similarity index 100% rename from docs/docs/internals/syntax.md rename to docs/_docs/internals/syntax.md diff --git a/docs/docs/internals/type-system.md b/docs/_docs/internals/type-system.md similarity index 100% rename from docs/docs/internals/type-system.md rename to docs/_docs/internals/type-system.md diff --git a/docs/docs/reference/changed-features/changed-features.md b/docs/_docs/reference/changed-features/changed-features.md similarity index 100% rename from docs/docs/reference/changed-features/changed-features.md rename to docs/_docs/reference/changed-features/changed-features.md diff --git a/docs/docs/reference/changed-features/compiler-plugins.md b/docs/_docs/reference/changed-features/compiler-plugins.md similarity index 100% rename from docs/docs/reference/changed-features/compiler-plugins.md rename to docs/_docs/reference/changed-features/compiler-plugins.md diff --git a/docs/docs/reference/changed-features/eta-expansion-spec.md b/docs/_docs/reference/changed-features/eta-expansion-spec.md similarity index 100% rename from docs/docs/reference/changed-features/eta-expansion-spec.md rename to docs/_docs/reference/changed-features/eta-expansion-spec.md diff --git a/docs/docs/reference/changed-features/eta-expansion.md b/docs/_docs/reference/changed-features/eta-expansion.md similarity index 100% rename from docs/docs/reference/changed-features/eta-expansion.md rename to docs/_docs/reference/changed-features/eta-expansion.md diff --git a/docs/docs/reference/changed-features/implicit-conversions-spec.md b/docs/_docs/reference/changed-features/implicit-conversions-spec.md similarity index 100% rename from docs/docs/reference/changed-features/implicit-conversions-spec.md rename to docs/_docs/reference/changed-features/implicit-conversions-spec.md diff --git a/docs/docs/reference/changed-features/implicit-conversions.md b/docs/_docs/reference/changed-features/implicit-conversions.md similarity index 100% rename from docs/docs/reference/changed-features/implicit-conversions.md rename to docs/_docs/reference/changed-features/implicit-conversions.md diff --git a/docs/docs/reference/changed-features/implicit-resolution.md b/docs/_docs/reference/changed-features/implicit-resolution.md similarity index 100% rename from docs/docs/reference/changed-features/implicit-resolution.md rename to docs/_docs/reference/changed-features/implicit-resolution.md diff --git a/docs/docs/reference/changed-features/imports.md b/docs/_docs/reference/changed-features/imports.md similarity index 100% rename from docs/docs/reference/changed-features/imports.md rename to docs/_docs/reference/changed-features/imports.md diff --git a/docs/docs/reference/changed-features/interpolation-escapes.md b/docs/_docs/reference/changed-features/interpolation-escapes.md similarity index 100% rename from docs/docs/reference/changed-features/interpolation-escapes.md rename to docs/_docs/reference/changed-features/interpolation-escapes.md diff --git a/docs/docs/reference/changed-features/lazy-vals-init.md b/docs/_docs/reference/changed-features/lazy-vals-init.md similarity index 100% rename from docs/docs/reference/changed-features/lazy-vals-init.md rename to docs/_docs/reference/changed-features/lazy-vals-init.md diff --git a/docs/docs/reference/changed-features/main-functions.md b/docs/_docs/reference/changed-features/main-functions.md similarity index 100% rename from docs/docs/reference/changed-features/main-functions.md rename to docs/_docs/reference/changed-features/main-functions.md diff --git a/docs/docs/reference/changed-features/match-syntax.md b/docs/_docs/reference/changed-features/match-syntax.md similarity index 100% rename from docs/docs/reference/changed-features/match-syntax.md rename to docs/_docs/reference/changed-features/match-syntax.md diff --git a/docs/docs/reference/changed-features/numeric-literals.md b/docs/_docs/reference/changed-features/numeric-literals.md similarity index 100% rename from docs/docs/reference/changed-features/numeric-literals.md rename to docs/_docs/reference/changed-features/numeric-literals.md diff --git a/docs/docs/reference/changed-features/operators.md b/docs/_docs/reference/changed-features/operators.md similarity index 100% rename from docs/docs/reference/changed-features/operators.md rename to docs/_docs/reference/changed-features/operators.md diff --git a/docs/docs/reference/changed-features/overload-resolution.md b/docs/_docs/reference/changed-features/overload-resolution.md similarity index 100% rename from docs/docs/reference/changed-features/overload-resolution.md rename to docs/_docs/reference/changed-features/overload-resolution.md diff --git a/docs/docs/reference/changed-features/pattern-bindings.md b/docs/_docs/reference/changed-features/pattern-bindings.md similarity index 100% rename from docs/docs/reference/changed-features/pattern-bindings.md rename to docs/_docs/reference/changed-features/pattern-bindings.md diff --git a/docs/docs/reference/changed-features/pattern-matching.md b/docs/_docs/reference/changed-features/pattern-matching.md similarity index 100% rename from docs/docs/reference/changed-features/pattern-matching.md rename to docs/_docs/reference/changed-features/pattern-matching.md diff --git a/docs/docs/reference/changed-features/structural-types-spec.md b/docs/_docs/reference/changed-features/structural-types-spec.md similarity index 100% rename from docs/docs/reference/changed-features/structural-types-spec.md rename to docs/_docs/reference/changed-features/structural-types-spec.md diff --git a/docs/docs/reference/changed-features/structural-types.md b/docs/_docs/reference/changed-features/structural-types.md similarity index 100% rename from docs/docs/reference/changed-features/structural-types.md rename to docs/_docs/reference/changed-features/structural-types.md diff --git a/docs/docs/reference/changed-features/type-checking.md b/docs/_docs/reference/changed-features/type-checking.md similarity index 100% rename from docs/docs/reference/changed-features/type-checking.md rename to docs/_docs/reference/changed-features/type-checking.md diff --git a/docs/docs/reference/changed-features/type-inference.md b/docs/_docs/reference/changed-features/type-inference.md similarity index 100% rename from docs/docs/reference/changed-features/type-inference.md rename to docs/_docs/reference/changed-features/type-inference.md diff --git a/docs/docs/reference/changed-features/vararg-splices.md b/docs/_docs/reference/changed-features/vararg-splices.md similarity index 100% rename from docs/docs/reference/changed-features/vararg-splices.md rename to docs/_docs/reference/changed-features/vararg-splices.md diff --git a/docs/docs/reference/changed-features/wildcards.md b/docs/_docs/reference/changed-features/wildcards.md similarity index 100% rename from docs/docs/reference/changed-features/wildcards.md rename to docs/_docs/reference/changed-features/wildcards.md diff --git a/docs/docs/reference/contextual/by-name-context-parameters.md b/docs/_docs/reference/contextual/by-name-context-parameters.md similarity index 100% rename from docs/docs/reference/contextual/by-name-context-parameters.md rename to docs/_docs/reference/contextual/by-name-context-parameters.md diff --git a/docs/docs/reference/contextual/context-bounds.md b/docs/_docs/reference/contextual/context-bounds.md similarity index 100% rename from docs/docs/reference/contextual/context-bounds.md rename to docs/_docs/reference/contextual/context-bounds.md diff --git a/docs/docs/reference/contextual/context-functions-spec.md b/docs/_docs/reference/contextual/context-functions-spec.md similarity index 100% rename from docs/docs/reference/contextual/context-functions-spec.md rename to docs/_docs/reference/contextual/context-functions-spec.md diff --git a/docs/docs/reference/contextual/context-functions.md b/docs/_docs/reference/contextual/context-functions.md similarity index 100% rename from docs/docs/reference/contextual/context-functions.md rename to docs/_docs/reference/contextual/context-functions.md diff --git a/docs/docs/reference/contextual/contextual.md b/docs/_docs/reference/contextual/contextual.md similarity index 100% rename from docs/docs/reference/contextual/contextual.md rename to docs/_docs/reference/contextual/contextual.md diff --git a/docs/docs/reference/contextual/conversions.md b/docs/_docs/reference/contextual/conversions.md similarity index 100% rename from docs/docs/reference/contextual/conversions.md rename to docs/_docs/reference/contextual/conversions.md diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/_docs/reference/contextual/derivation-macro.md similarity index 100% rename from docs/docs/reference/contextual/derivation-macro.md rename to docs/_docs/reference/contextual/derivation-macro.md diff --git a/docs/docs/reference/contextual/derivation.md b/docs/_docs/reference/contextual/derivation.md similarity index 100% rename from docs/docs/reference/contextual/derivation.md rename to docs/_docs/reference/contextual/derivation.md diff --git a/docs/docs/reference/contextual/extension-methods.md b/docs/_docs/reference/contextual/extension-methods.md similarity index 100% rename from docs/docs/reference/contextual/extension-methods.md rename to docs/_docs/reference/contextual/extension-methods.md diff --git a/docs/docs/reference/contextual/given-imports.md b/docs/_docs/reference/contextual/given-imports.md similarity index 100% rename from docs/docs/reference/contextual/given-imports.md rename to docs/_docs/reference/contextual/given-imports.md diff --git a/docs/docs/reference/contextual/givens.md b/docs/_docs/reference/contextual/givens.md similarity index 100% rename from docs/docs/reference/contextual/givens.md rename to docs/_docs/reference/contextual/givens.md diff --git a/docs/docs/reference/contextual/multiversal-equality.md b/docs/_docs/reference/contextual/multiversal-equality.md similarity index 100% rename from docs/docs/reference/contextual/multiversal-equality.md rename to docs/_docs/reference/contextual/multiversal-equality.md diff --git a/docs/docs/reference/contextual/relationship-implicits.md b/docs/_docs/reference/contextual/relationship-implicits.md similarity index 100% rename from docs/docs/reference/contextual/relationship-implicits.md rename to docs/_docs/reference/contextual/relationship-implicits.md diff --git a/docs/docs/reference/contextual/right-associative-extension-methods.md b/docs/_docs/reference/contextual/right-associative-extension-methods.md similarity index 100% rename from docs/docs/reference/contextual/right-associative-extension-methods.md rename to docs/_docs/reference/contextual/right-associative-extension-methods.md diff --git a/docs/docs/reference/contextual/type-classes.md b/docs/_docs/reference/contextual/type-classes.md similarity index 100% rename from docs/docs/reference/contextual/type-classes.md rename to docs/_docs/reference/contextual/type-classes.md diff --git a/docs/docs/reference/contextual/using-clauses.md b/docs/_docs/reference/contextual/using-clauses.md similarity index 100% rename from docs/docs/reference/contextual/using-clauses.md rename to docs/_docs/reference/contextual/using-clauses.md diff --git a/docs/docs/reference/dropped-features/auto-apply.md b/docs/_docs/reference/dropped-features/auto-apply.md similarity index 100% rename from docs/docs/reference/dropped-features/auto-apply.md rename to docs/_docs/reference/dropped-features/auto-apply.md diff --git a/docs/docs/reference/dropped-features/class-shadowing-spec.md b/docs/_docs/reference/dropped-features/class-shadowing-spec.md similarity index 100% rename from docs/docs/reference/dropped-features/class-shadowing-spec.md rename to docs/_docs/reference/dropped-features/class-shadowing-spec.md diff --git a/docs/docs/reference/dropped-features/class-shadowing.md b/docs/_docs/reference/dropped-features/class-shadowing.md similarity index 100% rename from docs/docs/reference/dropped-features/class-shadowing.md rename to docs/_docs/reference/dropped-features/class-shadowing.md diff --git a/docs/docs/reference/dropped-features/delayed-init.md b/docs/_docs/reference/dropped-features/delayed-init.md similarity index 100% rename from docs/docs/reference/dropped-features/delayed-init.md rename to docs/_docs/reference/dropped-features/delayed-init.md diff --git a/docs/docs/reference/dropped-features/do-while.md b/docs/_docs/reference/dropped-features/do-while.md similarity index 100% rename from docs/docs/reference/dropped-features/do-while.md rename to docs/_docs/reference/dropped-features/do-while.md diff --git a/docs/docs/reference/dropped-features/dropped-features.md b/docs/_docs/reference/dropped-features/dropped-features.md similarity index 100% rename from docs/docs/reference/dropped-features/dropped-features.md rename to docs/_docs/reference/dropped-features/dropped-features.md diff --git a/docs/docs/reference/dropped-features/early-initializers.md b/docs/_docs/reference/dropped-features/early-initializers.md similarity index 100% rename from docs/docs/reference/dropped-features/early-initializers.md rename to docs/_docs/reference/dropped-features/early-initializers.md diff --git a/docs/docs/reference/dropped-features/existential-types.md b/docs/_docs/reference/dropped-features/existential-types.md similarity index 100% rename from docs/docs/reference/dropped-features/existential-types.md rename to docs/_docs/reference/dropped-features/existential-types.md diff --git a/docs/docs/reference/dropped-features/limit22.md b/docs/_docs/reference/dropped-features/limit22.md similarity index 100% rename from docs/docs/reference/dropped-features/limit22.md rename to docs/_docs/reference/dropped-features/limit22.md diff --git a/docs/docs/reference/dropped-features/macros.md b/docs/_docs/reference/dropped-features/macros.md similarity index 100% rename from docs/docs/reference/dropped-features/macros.md rename to docs/_docs/reference/dropped-features/macros.md diff --git a/docs/docs/reference/dropped-features/nonlocal-returns.md b/docs/_docs/reference/dropped-features/nonlocal-returns.md similarity index 100% rename from docs/docs/reference/dropped-features/nonlocal-returns.md rename to docs/_docs/reference/dropped-features/nonlocal-returns.md diff --git a/docs/docs/reference/dropped-features/package-objects.md b/docs/_docs/reference/dropped-features/package-objects.md similarity index 100% rename from docs/docs/reference/dropped-features/package-objects.md rename to docs/_docs/reference/dropped-features/package-objects.md diff --git a/docs/docs/reference/dropped-features/procedure-syntax.md b/docs/_docs/reference/dropped-features/procedure-syntax.md similarity index 100% rename from docs/docs/reference/dropped-features/procedure-syntax.md rename to docs/_docs/reference/dropped-features/procedure-syntax.md diff --git a/docs/docs/reference/dropped-features/symlits.md b/docs/_docs/reference/dropped-features/symlits.md similarity index 100% rename from docs/docs/reference/dropped-features/symlits.md rename to docs/_docs/reference/dropped-features/symlits.md diff --git a/docs/docs/reference/dropped-features/this-qualifier.md b/docs/_docs/reference/dropped-features/this-qualifier.md similarity index 100% rename from docs/docs/reference/dropped-features/this-qualifier.md rename to docs/_docs/reference/dropped-features/this-qualifier.md diff --git a/docs/docs/reference/dropped-features/type-projection.md b/docs/_docs/reference/dropped-features/type-projection.md similarity index 100% rename from docs/docs/reference/dropped-features/type-projection.md rename to docs/_docs/reference/dropped-features/type-projection.md diff --git a/docs/docs/reference/dropped-features/weak-conformance-spec.md b/docs/_docs/reference/dropped-features/weak-conformance-spec.md similarity index 100% rename from docs/docs/reference/dropped-features/weak-conformance-spec.md rename to docs/_docs/reference/dropped-features/weak-conformance-spec.md diff --git a/docs/docs/reference/dropped-features/weak-conformance.md b/docs/_docs/reference/dropped-features/weak-conformance.md similarity index 100% rename from docs/docs/reference/dropped-features/weak-conformance.md rename to docs/_docs/reference/dropped-features/weak-conformance.md diff --git a/docs/docs/reference/dropped-features/wildcard-init.md b/docs/_docs/reference/dropped-features/wildcard-init.md similarity index 100% rename from docs/docs/reference/dropped-features/wildcard-init.md rename to docs/_docs/reference/dropped-features/wildcard-init.md diff --git a/docs/docs/reference/dropped-features/xml.md b/docs/_docs/reference/dropped-features/xml.md similarity index 100% rename from docs/docs/reference/dropped-features/xml.md rename to docs/_docs/reference/dropped-features/xml.md diff --git a/docs/docs/reference/enums/adts.md b/docs/_docs/reference/enums/adts.md similarity index 100% rename from docs/docs/reference/enums/adts.md rename to docs/_docs/reference/enums/adts.md diff --git a/docs/docs/reference/enums/desugarEnums.md b/docs/_docs/reference/enums/desugarEnums.md similarity index 100% rename from docs/docs/reference/enums/desugarEnums.md rename to docs/_docs/reference/enums/desugarEnums.md diff --git a/docs/docs/reference/enums/enums-index.md b/docs/_docs/reference/enums/enums-index.md similarity index 100% rename from docs/docs/reference/enums/enums-index.md rename to docs/_docs/reference/enums/enums-index.md diff --git a/docs/docs/reference/enums/enums.md b/docs/_docs/reference/enums/enums.md similarity index 100% rename from docs/docs/reference/enums/enums.md rename to docs/_docs/reference/enums/enums.md diff --git a/docs/docs/reference/experimental/canthrow.md b/docs/_docs/reference/experimental/canthrow.md similarity index 100% rename from docs/docs/reference/experimental/canthrow.md rename to docs/_docs/reference/experimental/canthrow.md diff --git a/docs/docs/reference/experimental/cc.md b/docs/_docs/reference/experimental/cc.md similarity index 100% rename from docs/docs/reference/experimental/cc.md rename to docs/_docs/reference/experimental/cc.md diff --git a/docs/docs/reference/experimental/erased-defs-spec.md b/docs/_docs/reference/experimental/erased-defs-spec.md similarity index 100% rename from docs/docs/reference/experimental/erased-defs-spec.md rename to docs/_docs/reference/experimental/erased-defs-spec.md diff --git a/docs/docs/reference/experimental/erased-defs.md b/docs/_docs/reference/experimental/erased-defs.md similarity index 100% rename from docs/docs/reference/experimental/erased-defs.md rename to docs/_docs/reference/experimental/erased-defs.md diff --git a/docs/docs/reference/experimental/explicit-nulls.md b/docs/_docs/reference/experimental/explicit-nulls.md similarity index 100% rename from docs/docs/reference/experimental/explicit-nulls.md rename to docs/_docs/reference/experimental/explicit-nulls.md diff --git a/docs/docs/reference/experimental/named-typeargs-spec.md b/docs/_docs/reference/experimental/named-typeargs-spec.md similarity index 100% rename from docs/docs/reference/experimental/named-typeargs-spec.md rename to docs/_docs/reference/experimental/named-typeargs-spec.md diff --git a/docs/docs/reference/experimental/named-typeargs.md b/docs/_docs/reference/experimental/named-typeargs.md similarity index 100% rename from docs/docs/reference/experimental/named-typeargs.md rename to docs/_docs/reference/experimental/named-typeargs.md diff --git a/docs/docs/reference/experimental/numeric-literals.md b/docs/_docs/reference/experimental/numeric-literals.md similarity index 100% rename from docs/docs/reference/experimental/numeric-literals.md rename to docs/_docs/reference/experimental/numeric-literals.md diff --git a/docs/docs/reference/experimental/overview.md b/docs/_docs/reference/experimental/overview.md similarity index 100% rename from docs/docs/reference/experimental/overview.md rename to docs/_docs/reference/experimental/overview.md diff --git a/docs/docs/reference/features-classification.md b/docs/_docs/reference/features-classification.md similarity index 100% rename from docs/docs/reference/features-classification.md rename to docs/_docs/reference/features-classification.md diff --git a/docs/docs/reference/language-versions/binary-compatibility.md b/docs/_docs/reference/language-versions/binary-compatibility.md similarity index 100% rename from docs/docs/reference/language-versions/binary-compatibility.md rename to docs/_docs/reference/language-versions/binary-compatibility.md diff --git a/docs/docs/reference/language-versions/language-versions.md b/docs/_docs/reference/language-versions/language-versions.md similarity index 100% rename from docs/docs/reference/language-versions/language-versions.md rename to docs/_docs/reference/language-versions/language-versions.md diff --git a/docs/docs/reference/language-versions/source-compatibility.md b/docs/_docs/reference/language-versions/source-compatibility.md similarity index 100% rename from docs/docs/reference/language-versions/source-compatibility.md rename to docs/_docs/reference/language-versions/source-compatibility.md diff --git a/docs/docs/reference/metaprogramming/compiletime-ops.md b/docs/_docs/reference/metaprogramming/compiletime-ops.md similarity index 100% rename from docs/docs/reference/metaprogramming/compiletime-ops.md rename to docs/_docs/reference/metaprogramming/compiletime-ops.md diff --git a/docs/docs/reference/metaprogramming/inline.md b/docs/_docs/reference/metaprogramming/inline.md similarity index 100% rename from docs/docs/reference/metaprogramming/inline.md rename to docs/_docs/reference/metaprogramming/inline.md diff --git a/docs/docs/reference/metaprogramming/macros-spec.md b/docs/_docs/reference/metaprogramming/macros-spec.md similarity index 100% rename from docs/docs/reference/metaprogramming/macros-spec.md rename to docs/_docs/reference/metaprogramming/macros-spec.md diff --git a/docs/docs/reference/metaprogramming/macros.md b/docs/_docs/reference/metaprogramming/macros.md similarity index 100% rename from docs/docs/reference/metaprogramming/macros.md rename to docs/_docs/reference/metaprogramming/macros.md diff --git a/docs/docs/reference/metaprogramming/metaprogramming.md b/docs/_docs/reference/metaprogramming/metaprogramming.md similarity index 100% rename from docs/docs/reference/metaprogramming/metaprogramming.md rename to docs/_docs/reference/metaprogramming/metaprogramming.md diff --git a/docs/docs/reference/metaprogramming/reflection.md b/docs/_docs/reference/metaprogramming/reflection.md similarity index 100% rename from docs/docs/reference/metaprogramming/reflection.md rename to docs/_docs/reference/metaprogramming/reflection.md diff --git a/docs/docs/reference/metaprogramming/simple-smp.md b/docs/_docs/reference/metaprogramming/simple-smp.md similarity index 100% rename from docs/docs/reference/metaprogramming/simple-smp.md rename to docs/_docs/reference/metaprogramming/simple-smp.md diff --git a/docs/docs/reference/metaprogramming/staging.md b/docs/_docs/reference/metaprogramming/staging.md similarity index 100% rename from docs/docs/reference/metaprogramming/staging.md rename to docs/_docs/reference/metaprogramming/staging.md diff --git a/docs/docs/reference/metaprogramming/tasty-inspect.md b/docs/_docs/reference/metaprogramming/tasty-inspect.md similarity index 100% rename from docs/docs/reference/metaprogramming/tasty-inspect.md rename to docs/_docs/reference/metaprogramming/tasty-inspect.md diff --git a/docs/docs/reference/new-types/dependent-function-types-spec.md b/docs/_docs/reference/new-types/dependent-function-types-spec.md similarity index 100% rename from docs/docs/reference/new-types/dependent-function-types-spec.md rename to docs/_docs/reference/new-types/dependent-function-types-spec.md diff --git a/docs/docs/reference/new-types/dependent-function-types.md b/docs/_docs/reference/new-types/dependent-function-types.md similarity index 100% rename from docs/docs/reference/new-types/dependent-function-types.md rename to docs/_docs/reference/new-types/dependent-function-types.md diff --git a/docs/docs/reference/new-types/intersection-types-spec.md b/docs/_docs/reference/new-types/intersection-types-spec.md similarity index 100% rename from docs/docs/reference/new-types/intersection-types-spec.md rename to docs/_docs/reference/new-types/intersection-types-spec.md diff --git a/docs/docs/reference/new-types/intersection-types.md b/docs/_docs/reference/new-types/intersection-types.md similarity index 100% rename from docs/docs/reference/new-types/intersection-types.md rename to docs/_docs/reference/new-types/intersection-types.md diff --git a/docs/docs/reference/new-types/match-types.md b/docs/_docs/reference/new-types/match-types.md similarity index 100% rename from docs/docs/reference/new-types/match-types.md rename to docs/_docs/reference/new-types/match-types.md diff --git a/docs/docs/reference/new-types/new-types.md b/docs/_docs/reference/new-types/new-types.md similarity index 100% rename from docs/docs/reference/new-types/new-types.md rename to docs/_docs/reference/new-types/new-types.md diff --git a/docs/docs/reference/new-types/polymorphic-function-types.md b/docs/_docs/reference/new-types/polymorphic-function-types.md similarity index 100% rename from docs/docs/reference/new-types/polymorphic-function-types.md rename to docs/_docs/reference/new-types/polymorphic-function-types.md diff --git a/docs/docs/reference/new-types/type-lambdas-spec.md b/docs/_docs/reference/new-types/type-lambdas-spec.md similarity index 100% rename from docs/docs/reference/new-types/type-lambdas-spec.md rename to docs/_docs/reference/new-types/type-lambdas-spec.md diff --git a/docs/docs/reference/new-types/type-lambdas.md b/docs/_docs/reference/new-types/type-lambdas.md similarity index 100% rename from docs/docs/reference/new-types/type-lambdas.md rename to docs/_docs/reference/new-types/type-lambdas.md diff --git a/docs/docs/reference/new-types/union-types-spec.md b/docs/_docs/reference/new-types/union-types-spec.md similarity index 100% rename from docs/docs/reference/new-types/union-types-spec.md rename to docs/_docs/reference/new-types/union-types-spec.md diff --git a/docs/docs/reference/new-types/union-types.md b/docs/_docs/reference/new-types/union-types.md similarity index 100% rename from docs/docs/reference/new-types/union-types.md rename to docs/_docs/reference/new-types/union-types.md diff --git a/docs/docs/reference/other-new-features/control-syntax.md b/docs/_docs/reference/other-new-features/control-syntax.md similarity index 100% rename from docs/docs/reference/other-new-features/control-syntax.md rename to docs/_docs/reference/other-new-features/control-syntax.md diff --git a/docs/docs/reference/other-new-features/creator-applications.md b/docs/_docs/reference/other-new-features/creator-applications.md similarity index 100% rename from docs/docs/reference/other-new-features/creator-applications.md rename to docs/_docs/reference/other-new-features/creator-applications.md diff --git a/docs/docs/reference/other-new-features/experimental-defs.md b/docs/_docs/reference/other-new-features/experimental-defs.md similarity index 100% rename from docs/docs/reference/other-new-features/experimental-defs.md rename to docs/_docs/reference/other-new-features/experimental-defs.md diff --git a/docs/docs/reference/other-new-features/export.md b/docs/_docs/reference/other-new-features/export.md similarity index 100% rename from docs/docs/reference/other-new-features/export.md rename to docs/_docs/reference/other-new-features/export.md diff --git a/docs/docs/reference/other-new-features/indentation-experimental.md b/docs/_docs/reference/other-new-features/indentation-experimental.md similarity index 100% rename from docs/docs/reference/other-new-features/indentation-experimental.md rename to docs/_docs/reference/other-new-features/indentation-experimental.md diff --git a/docs/docs/reference/other-new-features/indentation.md b/docs/_docs/reference/other-new-features/indentation.md similarity index 100% rename from docs/docs/reference/other-new-features/indentation.md rename to docs/_docs/reference/other-new-features/indentation.md diff --git a/docs/docs/reference/other-new-features/kind-polymorphism.md b/docs/_docs/reference/other-new-features/kind-polymorphism.md similarity index 100% rename from docs/docs/reference/other-new-features/kind-polymorphism.md rename to docs/_docs/reference/other-new-features/kind-polymorphism.md diff --git a/docs/docs/reference/other-new-features/matchable.md b/docs/_docs/reference/other-new-features/matchable.md similarity index 100% rename from docs/docs/reference/other-new-features/matchable.md rename to docs/_docs/reference/other-new-features/matchable.md diff --git a/docs/docs/reference/other-new-features/opaques-details.md b/docs/_docs/reference/other-new-features/opaques-details.md similarity index 100% rename from docs/docs/reference/other-new-features/opaques-details.md rename to docs/_docs/reference/other-new-features/opaques-details.md diff --git a/docs/docs/reference/other-new-features/opaques.md b/docs/_docs/reference/other-new-features/opaques.md similarity index 100% rename from docs/docs/reference/other-new-features/opaques.md rename to docs/_docs/reference/other-new-features/opaques.md diff --git a/docs/docs/reference/other-new-features/open-classes.md b/docs/_docs/reference/other-new-features/open-classes.md similarity index 100% rename from docs/docs/reference/other-new-features/open-classes.md rename to docs/_docs/reference/other-new-features/open-classes.md diff --git a/docs/docs/reference/other-new-features/other-new-types.md b/docs/_docs/reference/other-new-features/other-new-types.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-types.md diff --git a/docs/docs/reference/other-new-features/parameter-untupling-spec.md b/docs/_docs/reference/other-new-features/parameter-untupling-spec.md similarity index 100% rename from docs/docs/reference/other-new-features/parameter-untupling-spec.md rename to docs/_docs/reference/other-new-features/parameter-untupling-spec.md diff --git a/docs/docs/reference/other-new-features/parameter-untupling.md b/docs/_docs/reference/other-new-features/parameter-untupling.md similarity index 100% rename from docs/docs/reference/other-new-features/parameter-untupling.md rename to docs/_docs/reference/other-new-features/parameter-untupling.md diff --git a/docs/docs/reference/other-new-features/safe-initialization.md b/docs/_docs/reference/other-new-features/safe-initialization.md similarity index 100% rename from docs/docs/reference/other-new-features/safe-initialization.md rename to docs/_docs/reference/other-new-features/safe-initialization.md diff --git a/docs/docs/reference/other-new-features/targetName.md b/docs/_docs/reference/other-new-features/targetName.md similarity index 100% rename from docs/docs/reference/other-new-features/targetName.md rename to docs/_docs/reference/other-new-features/targetName.md diff --git a/docs/docs/reference/other-new-features/threadUnsafe-annotation.md b/docs/_docs/reference/other-new-features/threadUnsafe-annotation.md similarity index 100% rename from docs/docs/reference/other-new-features/threadUnsafe-annotation.md rename to docs/_docs/reference/other-new-features/threadUnsafe-annotation.md diff --git a/docs/docs/reference/other-new-features/trait-parameters.md b/docs/_docs/reference/other-new-features/trait-parameters.md similarity index 100% rename from docs/docs/reference/other-new-features/trait-parameters.md rename to docs/_docs/reference/other-new-features/trait-parameters.md diff --git a/docs/docs/reference/other-new-features/transparent-traits.md b/docs/_docs/reference/other-new-features/transparent-traits.md similarity index 100% rename from docs/docs/reference/other-new-features/transparent-traits.md rename to docs/_docs/reference/other-new-features/transparent-traits.md diff --git a/docs/docs/reference/other-new-features/type-test.md b/docs/_docs/reference/other-new-features/type-test.md similarity index 100% rename from docs/docs/reference/other-new-features/type-test.md rename to docs/_docs/reference/other-new-features/type-test.md diff --git a/docs/docs/reference/overview.md b/docs/_docs/reference/overview.md similarity index 100% rename from docs/docs/reference/overview.md rename to docs/_docs/reference/overview.md diff --git a/docs/docs/reference/soft-modifier.md b/docs/_docs/reference/soft-modifier.md similarity index 100% rename from docs/docs/reference/soft-modifier.md rename to docs/_docs/reference/soft-modifier.md diff --git a/docs/docs/reference/syntax.md b/docs/_docs/reference/syntax.md similarity index 100% rename from docs/docs/reference/syntax.md rename to docs/_docs/reference/syntax.md diff --git a/docs/docs/release-notes/0.1.2.md b/docs/_docs/release-notes/0.1.2.md similarity index 100% rename from docs/docs/release-notes/0.1.2.md rename to docs/_docs/release-notes/0.1.2.md diff --git a/docs/docs/release-notes/syntax-changes-0.22.md b/docs/_docs/release-notes/syntax-changes-0.22.md similarity index 100% rename from docs/docs/release-notes/syntax-changes-0.22.md rename to docs/_docs/release-notes/syntax-changes-0.22.md diff --git a/docs/docs/usage/cbt-projects.md b/docs/_docs/usage/cbt-projects.md similarity index 100% rename from docs/docs/usage/cbt-projects.md rename to docs/_docs/usage/cbt-projects.md diff --git a/docs/docs/usage/dottydoc.md b/docs/_docs/usage/dottydoc.md similarity index 97% rename from docs/docs/usage/dottydoc.md rename to docs/_docs/usage/dottydoc.md index f7e15b692d99..28c29606a301 100644 --- a/docs/docs/usage/dottydoc.md +++ b/docs/_docs/usage/dottydoc.md @@ -92,7 +92,7 @@ It is also possible to use one of the [default layouts](#default-layouts) that s Blog ==== Dottydoc also allows for a simple blogging platform in the same vein as Jekyll. -Blog posts are placed within the `./blog/_posts` directory and have to be in +Blog posts are placed within the `./_blog/_posts` directory and have to be in the form `year-month-day-title.{md,html}`. An example of this would be: @@ -252,7 +252,7 @@ to alter the way Dottydoc renders API documentation. blog-page.html -------------- -A blog page uses files placed in `./blog/_posts/` as input to render a blog. +A blog page uses files placed in `./_blog/_posts/` as input to render a blog. Default Includes ================ diff --git a/docs/docs/usage/ide-support.md b/docs/_docs/usage/ide-support.md similarity index 100% rename from docs/docs/usage/ide-support.md rename to docs/_docs/usage/ide-support.md diff --git a/docs/docs/usage/sbt-projects.md b/docs/_docs/usage/sbt-projects.md similarity index 100% rename from docs/docs/usage/sbt-projects.md rename to docs/_docs/usage/sbt-projects.md diff --git a/docs/docs/usage/scaladoc/blog.md b/docs/_docs/usage/scaladoc/blog.md similarity index 100% rename from docs/docs/usage/scaladoc/blog.md rename to docs/_docs/usage/scaladoc/blog.md diff --git a/docs/docs/usage/scaladoc/docstrings.md b/docs/_docs/usage/scaladoc/docstrings.md similarity index 100% rename from docs/docs/usage/scaladoc/docstrings.md rename to docs/_docs/usage/scaladoc/docstrings.md diff --git a/docs/docs/usage/scaladoc/index.md b/docs/_docs/usage/scaladoc/index.md similarity index 82% rename from docs/docs/usage/scaladoc/index.md rename to docs/_docs/usage/scaladoc/index.md index edb56fc7dea5..dc53c01db666 100644 --- a/docs/docs/usage/scaladoc/index.md +++ b/docs/_docs/usage/scaladoc/index.md @@ -3,6 +3,6 @@ layout: doc-page title: "Scaladoc" --- -![scaladoc logo](images/scaladoc_logo.svg) +![scaladoc logo](images/scaladoc-logo.png) scaladoc is a tool to generate the API documentation of your Scala 3 projects. It provides similar features to `javadoc` as well as `jekyll` or `docusaurus`. diff --git a/docs/docs/usage/scaladoc/linking.md b/docs/_docs/usage/scaladoc/linking.md similarity index 100% rename from docs/docs/usage/scaladoc/linking.md rename to docs/_docs/usage/scaladoc/linking.md diff --git a/docs/docs/usage/scaladoc/search-engine.md b/docs/_docs/usage/scaladoc/search-engine.md similarity index 100% rename from docs/docs/usage/scaladoc/search-engine.md rename to docs/_docs/usage/scaladoc/search-engine.md diff --git a/docs/docs/usage/scaladoc/settings.md b/docs/_docs/usage/scaladoc/settings.md similarity index 100% rename from docs/docs/usage/scaladoc/settings.md rename to docs/_docs/usage/scaladoc/settings.md diff --git a/docs/docs/usage/scaladoc/site-versioning.md b/docs/_docs/usage/scaladoc/site-versioning.md similarity index 100% rename from docs/docs/usage/scaladoc/site-versioning.md rename to docs/_docs/usage/scaladoc/site-versioning.md diff --git a/docs/docs/usage/scaladoc/static-site.md b/docs/_docs/usage/scaladoc/static-site.md similarity index 100% rename from docs/docs/usage/scaladoc/static-site.md rename to docs/_docs/usage/scaladoc/static-site.md diff --git a/docs/docs/usage/version-numbers.md b/docs/_docs/usage/version-numbers.md similarity index 100% rename from docs/docs/usage/version-numbers.md rename to docs/_docs/usage/version-numbers.md diff --git a/docs/docs/usage/worksheet-mode-implementation-details.md b/docs/_docs/usage/worksheet-mode-implementation-details.md similarity index 100% rename from docs/docs/usage/worksheet-mode-implementation-details.md rename to docs/_docs/usage/worksheet-mode-implementation-details.md diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 3c60f2d3fc8b..000000000000 --- a/docs/index.html +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: Scala 3 -layout: main -hasFrame: false -extraCSS: - - css/frontpage.css ---- - -
-
- -
-
-
- logo -
-

Scala 3

-

A next-generation compiler for Scala

-

(scroll down for more info)

-
-
-
-
-
-
- -

Try Scala 3

-

There are multiple ways of getting started with Scala 3.

-
    -
  1. You can try Scala 3 in your browser with Scastie.
  2. -
  3. If you already have sbt installed, you can create a Scala 3 project and sbt will take care of the rest.
  4. -
  5. You can install all necessary dependencies with coursier by running cs setup. You can also run cs install scala3-compiler or cs install scala3-repl to install command-line commands for the compiler and repl, correspondingly.
  6. -
  7. You can manually install Scala 3 on your computer.
  8. -
- -

Install Scala 3

-

If you are a Mac user, you can install Scala 3 with brew:

-
brew install lampepfl/brew/dotty
- -

- If you are a Linux or Windows user, as a prerequisite you need a JDK 8 or later properly installed on your system. The environment variable JAVA_HOME should point to your Java installation.
- For Windows users, we recommend using the Windows subsystem for linux or some other bash shell like git bash.
- Then download the latest release. Optionally add the path of the folder bin/ to the system environment variable PATH. -

- -

Now you can compile Scala source code:

-
scalac hello.scala
- -

To start the REPL, run: scala.

- -

Create a Scala 3 Project

-

The fastest way to create a new project in Scala 3 is using sbt (1.1.4+).

- -

Create a Scala 3 project:

-
sbt new scala/scala3.g8
- -

Or a Scala 3 project that cross compiles with Scala 2:

-
sbt new lampepfl/dotty-cross.g8
- -

For documentation see the Scala 3 Example Project.

- -

Learn more about Scala 3

-

You can find much more information about Scala 3 in ...

- -
-
diff --git a/docs/sidebar.yml b/docs/sidebar.yml index be2d0d0e59d9..3322200acc32 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -1,155 +1,186 @@ -sidebar: - - title: Blog +index: index.md +subsection: - title: Usage subsection: - - page: docs/usage/sbt-projects.md - - page: docs/usage/ide-support.md - - page: docs/usage/cbt-projects.md - - page: docs/usage/scaladoc + - page: usage/sbt-projects.md + - page: usage/ide-support.md + - page: usage/cbt-projects.md + - title: Scaladoc + index: usage/scaladoc/index.md + subsection: + - page: usage/scaladoc/docstrings.md + - page: usage/scaladoc/linking.md + - page: usage/scaladoc/search-engine.md + - page: usage/scaladoc/settings.md + - page: usage/scaladoc/site-versioning.md + - page: usage/scaladoc/static-site.md - title: Reference subsection: - - page: docs/reference/overview.md + - page: reference/overview.md - title: New Types - index: docs/reference/new-types/new-types.md + index: reference/new-types/new-types.md subsection: - - page: docs/reference/new-types/intersection-types.md - - page: docs/reference/new-types/union-types.md - - page: docs/reference/new-types/type-lambdas.md - - page: docs/reference/new-types/match-types.md - - page: docs/reference/new-types/dependent-function-types.md - - page: docs/reference/new-types/polymorphic-function-types.md + - page: reference/new-types/intersection-types.md + - page: reference/new-types/intersection-types-spec.md + - page: reference/new-types/union-types.md + - page: reference/new-types/union-types-spec.md + - page: reference/new-types/type-lambdas.md + - page: reference/new-types/type-lambdas-spec.md + - page: reference/new-types/match-types.md + - page: reference/new-types/dependent-function-types.md + - page: reference/new-types/dependent-function-types-spec.md + - page: reference/new-types/polymorphic-function-types.md - title: Enums - index: docs/reference/enums/enums-index.md + index: reference/enums/enums-index.md subsection: - - page: docs/reference/enums/enums.md - - page: docs/reference/enums/adts.md - - page: docs/reference/enums/desugarEnums.md + - page: reference/enums/enums.md + - page: reference/enums/adts.md + - page: reference/enums/desugarEnums.md - title: Contextual Abstractions - index: docs/reference/contextual/contextual.md + index: reference/contextual/contextual.md + directory: contextual subsection: - - page: docs/reference/contextual/givens.md - - page: docs/reference/contextual/using-clauses.md - - page: docs/reference/contextual/context-bounds.md - - page: docs/reference/contextual/given-imports.md - - page: docs/reference/contextual/extension-methods.md - - page: docs/reference/contextual/type-classes.md - - page: docs/reference/contextual/derivation.md - - page: docs/reference/contextual/multiversal-equality.md - - page: docs/reference/contextual/context-functions.md - - page: docs/reference/contextual/conversions.md - - page: docs/reference/contextual/by-name-context-parameters.md - - page: docs/reference/contextual/relationship-implicits.md + - page: reference/contextual/givens.md + - page: reference/contextual/using-clauses.md + - page: reference/contextual/context-bounds.md + - page: reference/contextual/given-imports.md + - page: reference/contextual/extension-methods.md + - page: reference/contextual/right-associative-extension-methods.md + - page: reference/contextual/type-classes.md + - page: reference/contextual/derivation.md + - page: reference/contextual/derivation-macro.md + - page: reference/contextual/multiversal-equality.md + - page: reference/contextual/context-functions.md + - page: reference/contextual/context-functions-spec.md + - page: reference/contextual/conversions.md + - page: reference/contextual/by-name-context-parameters.md + - page: reference/contextual/relationship-implicits.md - title: Metaprogramming - index: docs/reference/metaprogramming/metaprogramming.md + index: reference/metaprogramming/metaprogramming.md subsection: - - page: docs/reference/metaprogramming/inline.md - - page: docs/reference/metaprogramming/compiletime-ops.md - - page: docs/reference/metaprogramming/macros.md - - page: docs/reference/metaprogramming/staging.md - - page: docs/reference/metaprogramming/reflection.md - - page: docs/reference/metaprogramming/tasty-inspect.md + - page: reference/metaprogramming/inline.md + - page: reference/metaprogramming/compiletime-ops.md + - page: reference/metaprogramming/macros.md + - page: reference/metaprogramming/macros-spec.md + - page: reference/metaprogramming/staging.md + - page: reference/metaprogramming/reflection.md + - page: reference/metaprogramming/tasty-inspect.md - title: Other New Features - index: docs/reference/other-new-features/other-new-types.md + index: reference/other-new-features/other-new-types.md subsection: - - page: docs/reference/other-new-features/trait-parameters.md - - page: docs/reference/other-new-features/transparent-traits.md - - page: docs/reference/other-new-features/creator-applications.md - - page: docs/reference/other-new-features/export.md - - page: docs/reference/other-new-features/opaques.md - - page: docs/reference/other-new-features/open-classes.md - - page: docs/reference/other-new-features/parameter-untupling.md - - page: docs/reference/other-new-features/kind-polymorphism.md - - page: docs/reference/other-new-features/matchable.md - - page: docs/reference/other-new-features/threadUnsafe-annotation.md - - page: docs/reference/other-new-features/targetName.md - - page: docs/reference/other-new-features/control-syntax.md - - page: docs/reference/other-new-features/indentation.md - - page: docs/reference/other-new-features/safe-initialization.md - - page: docs/reference/other-new-features/type-test.md - - page: docs/reference/other-new-features/experimental-defs.md + - page: reference/other-new-features/trait-parameters.md + - page: reference/other-new-features/transparent-traits.md + - page: reference/other-new-features/creator-applications.md + - page: reference/other-new-features/export.md + - page: reference/other-new-features/opaques.md + - page: reference/other-new-features/opaques-details.md + - page: reference/other-new-features/open-classes.md + - page: reference/other-new-features/parameter-untupling.md + - page: reference/other-new-features/parameter-untupling-spec.md + - page: reference/other-new-features/kind-polymorphism.md + - page: reference/other-new-features/matchable.md + - page: reference/other-new-features/threadUnsafe-annotation.md + - page: reference/other-new-features/targetName.md + - page: reference/other-new-features/control-syntax.md + - page: reference/other-new-features/indentation.md + - page: reference/other-new-features/safe-initialization.md + - page: reference/other-new-features/type-test.md + - page: reference/other-new-features/experimental-defs.md - title: Other Changed Features - index: docs/reference/changed-features/changed-features.md + directory: changed-features + index: reference/changed-features/changed-features.md subsection: - - page: docs/reference/changed-features/numeric-literals.md - - page: docs/reference/changed-features/structural-types.md - - page: docs/reference/changed-features/operators.md - - page: docs/reference/changed-features/wildcards.md - - page: docs/reference/changed-features/imports.md - - page: docs/reference/changed-features/type-checking.md - - page: docs/reference/changed-features/type-inference.md - - page: docs/reference/changed-features/implicit-resolution.md - - page: docs/reference/changed-features/implicit-conversions.md - - page: docs/reference/changed-features/overload-resolution.md - - page: docs/reference/changed-features/match-syntax.md - - page: docs/reference/changed-features/vararg-splices.md - - page: docs/reference/changed-features/pattern-bindings.md - - page: docs/reference/changed-features/pattern-matching.md - - page: docs/reference/changed-features/eta-expansion.md - - page: docs/reference/changed-features/compiler-plugins.md - - page: docs/reference/changed-features/lazy-vals-init.md - - page: docs/reference/changed-features/main-functions.md + - page: reference/changed-features/numeric-literals.md + - page: reference/changed-features/structural-types.md + - page: reference/changed-features/structural-types-spec.md + - page: reference/changed-features/operators.md + - page: reference/changed-features/wildcards.md + - page: reference/changed-features/imports.md + - page: reference/changed-features/type-checking.md + - page: reference/changed-features/type-inference.md + - page: reference/changed-features/implicit-resolution.md + - page: reference/changed-features/implicit-conversions.md + - page: reference/changed-features/implicit-conversions-spec.md + - page: reference/changed-features/overload-resolution.md + - page: reference/changed-features/match-syntax.md + - page: reference/changed-features/vararg-splices.md + - page: reference/changed-features/pattern-bindings.md + - page: reference/changed-features/pattern-matching.md + - page: reference/changed-features/eta-expansion.md + - page: reference/changed-features/eta-expansion-spec.md + - page: reference/changed-features/compiler-plugins.md + - page: reference/changed-features/lazy-vals-init.md + - page: reference/changed-features/main-functions.md - title: Dropped Features - index: docs/reference/dropped-features/dropped-features.md + index: reference/dropped-features/dropped-features.md subsection: - - page: docs/reference/dropped-features/delayed-init.md - - page: docs/reference/dropped-features/macros.md - - page: docs/reference/dropped-features/existential-types.md - - page: docs/reference/dropped-features/type-projection.md - - page: docs/reference/dropped-features/do-while.md - - page: docs/reference/dropped-features/procedure-syntax.md - - page: docs/reference/dropped-features/package-objects.md - - page: docs/reference/dropped-features/early-initializers.md - - page: docs/reference/dropped-features/class-shadowing.md - - page: docs/reference/dropped-features/limit22.md - - page: docs/reference/dropped-features/xml.md - - page: docs/reference/dropped-features/symlits.md - - page: docs/reference/dropped-features/auto-apply.md - - page: docs/reference/dropped-features/weak-conformance.md - - page: docs/reference/dropped-features/nonlocal-returns.md - - page: docs/reference/dropped-features/this-qualifier.md - - page: docs/reference/dropped-features/wildcard-init.md + - page: reference/dropped-features/delayed-init.md + - page: reference/dropped-features/macros.md + - page: reference/dropped-features/existential-types.md + - page: reference/dropped-features/type-projection.md + - page: reference/dropped-features/do-while.md + - page: reference/dropped-features/procedure-syntax.md + - page: reference/dropped-features/package-objects.md + - page: reference/dropped-features/early-initializers.md + - page: reference/dropped-features/class-shadowing.md + - page: reference/dropped-features/class-shadowing-spec.md + - page: reference/dropped-features/limit22.md + - page: reference/dropped-features/xml.md + - page: reference/dropped-features/symlits.md + - page: reference/dropped-features/auto-apply.md + - page: reference/dropped-features/weak-conformance.md + - page: reference/dropped-features/weak-conformance-spec.md + - page: reference/dropped-features/nonlocal-returns.md + - page: reference/dropped-features/this-qualifier.md + - page: reference/dropped-features/wildcard-init.md - title: Experimental Features + directory: experimental subsection: - - page: docs/reference/experimental/overview.md - - page: docs/reference/experimental/canthrow.md - - page: docs/reference/experimental/erased-defs.md - - page: docs/reference/experimental/named-typeargs.md - - page: docs/reference/experimental/numeric-literals.md - - page: docs/reference/experimental/explicit-nulls.md - - page: docs/reference/experimental/cc.md - - page: docs/reference/syntax.md + - page: reference/experimental/overview.md + - page: reference/experimental/canthrow.md + - page: reference/experimental/erased-defs.md + - page: reference/experimental/erased-defs-spec.md + - page: reference/experimental/named-typeargs.md + - page: reference/experimental/named-typeargs-spec.md + - page: reference/experimental/numeric-literals.md + - page: reference/experimental/explicit-nulls.md + - page: reference/experimental/cc.md + - page: reference/syntax.md - title: Language Versions - index: docs/reference/language-versions/language-versions.md + index: reference/language-versions/language-versions.md subsection: - - page: docs/reference/language-versions/source-compatibility.md - - page: docs/reference/language-versions/binary-compatibility.md + - page: reference/language-versions/source-compatibility.md + - page: reference/language-versions/binary-compatibility.md + - page: reference/soft-modifier.md + - page: reference/features-classification.md - title: Contributing subsection: - - page: docs/contributing/contribute-knowledge.md - - page: docs/contributing/getting-started.md - - page: docs/contributing/workflow.md - - page: docs/contributing/testing.md - - page: docs/contributing/debugging.md + - page: contributing/contribute-knowledge.md + - page: contributing/getting-started.md + - page: contributing/workflow.md + - page: contributing/testing.md + - page: contributing/debugging.md - title: IDEs and Tools + directory: tools subsection: - - page: docs/contributing/tools/ide.md - - page: docs/contributing/tools/mill.md - - page: docs/contributing/tools/scalafix.md + - page: contributing/tools/ide.md + - page: contributing/tools/mill.md + - page: contributing/tools/scalafix.md - title: Procedures subsection: - - page: docs/contributing/procedures/release.md - - page: docs/contributing/procedures/vulpix.md + - page: contributing/procedures/release.md + - page: contributing/procedures/vulpix.md - title: Internals subsection: - - page: docs/internals/backend.md - - page: docs/internals/classpaths.md - - page: docs/internals/core-data-structures.md - - page: docs/internals/contexts.md - - page: docs/internals/dotc-scalac.md - - page: docs/internals/higher-kinded-v2.md - - page: docs/internals/overall-structure.md - - page: docs/internals/periods.md - - page: docs/internals/syntax.md - - page: docs/internals/type-system.md - - page: docs/internals/dotty-internals-1-notes.md - - page: docs/internals/debug-macros.md + - page: internals/backend.md + - page: internals/classpaths.md + - page: internals/core-data-structures.md + - page: internals/contexts.md + - page: internals/dotc-scalac.md + - page: internals/higher-kinded-v2.md + - page: internals/overall-structure.md + - page: internals/periods.md + - page: internals/syntax.md + - page: internals/type-system.md + - page: internals/dotty-internals-1-notes.md + - page: internals/debug-macros.md diff --git a/project/Build.scala b/project/Build.scala index e91849fdd1d3..21321e60d6d7 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -326,7 +326,7 @@ object Build { Seq( "-skip-by-regex:.+\\.internal($|\\..+)", "-skip-by-regex:.+\\.impl($|\\..+)", - "-project-logo", "docs/logo.svg", + "-project-logo", "docs/_assets/images/logo.svg", "-social-links:" + "github::https://github.com/lampepfl/dotty," + "discord::https://discord.com/invite/scala," + diff --git a/project/DocumentationWebsite.scala b/project/DocumentationWebsite.scala index 60a11e919e62..778c70ad2f0d 100644 --- a/project/DocumentationWebsite.scala +++ b/project/DocumentationWebsite.scala @@ -13,8 +13,8 @@ object DocumentationWebsite { ): Seq[File] = { - val contributorsTestcasesDestinationFile = Paths.get("scaladoc-testcases", "docs", "js", "contributors.js").toFile - val contributorsDestinationFile = Paths.get("docs", "js", "contributors.js").toFile + val contributorsTestcasesDestinationFile = Paths.get("scaladoc-testcases", "docs", "_assets", "js", "contributors.js").toFile + val contributorsDestinationFile = Paths.get("docs", "_assets", "js", "contributors.js").toFile sbt.IO.copyFile(contributorsFile, contributorsTestcasesDestinationFile) sbt.IO.copyFile(contributorsFile, contributorsDestinationFile) @@ -25,8 +25,8 @@ object DocumentationWebsite { val cssCodeSnippetsSourceFile = cssSourceFileBase / "code-snippets.css" sbt.IO.copyFile(cssCodeSnippetsSourceFile, cssCodeSnippetsDesitnationFile) - val cssContentContributorsTestcasesDesitnationFile = Paths.get("docs", "css", "content-contributors.css").toFile - val cssContentContributorsDesitnationFile = Paths.get("scaladoc-testcases", "docs", "css", "content-contributors.css").toFile + val cssContentContributorsTestcasesDesitnationFile = Paths.get("docs", "_assets", "css", "content-contributors.css").toFile + val cssContentContributorsDesitnationFile = Paths.get("scaladoc-testcases", "docs", "_assets", "css", "content-contributors.css").toFile val cssContentContributorsSourceFile = cssContentContributorsSourceBaseFile / "content-contributors.css" sbt.IO.copyFile(cssContentContributorsSourceFile, cssContentContributorsTestcasesDesitnationFile) sbt.IO.copyFile(cssContentContributorsSourceFile, cssContentContributorsDesitnationFile) diff --git a/project/scripts/cmdScaladocTests b/project/scripts/cmdScaladocTests index ce8d310fb248..ff25bc6a3940 100755 --- a/project/scripts/cmdScaladocTests +++ b/project/scripts/cmdScaladocTests @@ -29,7 +29,7 @@ dist/target/pack/bin/scaladoc \ "-external-mappings:.*scala/.*::scaladoc3::https://dotty.epfl.ch/api/,.*java/.*::javadoc::https://docs.oracle.com/javase/8/docs/api/" \ "-skip-by-regex:.+\.internal($|\..+)" \ "-skip-by-regex:.+\.impl($|\..+)" \ - -project-logo docs/logo.svg \ + -project-logo docs/_assets/images/logo.svg \ -social-links:github::https://github.com/lampepfl/dotty,discord::https://discord.com/invite/scala,twitter::https://twitter.com/scala_lang \ -Ygenerate-inkuire \ "-skip-by-id:scala.runtime.stdLibPatches" \ diff --git a/scaladoc-testcases/docs/css/bootstrap.min.css b/scaladoc-testcases/docs/_assets/css/bootstrap.min.css similarity index 100% rename from scaladoc-testcases/docs/css/bootstrap.min.css rename to scaladoc-testcases/docs/_assets/css/bootstrap.min.css diff --git a/scaladoc-testcases/docs/docs/docs/f1.md b/scaladoc-testcases/docs/_docs/docs/f1.md similarity index 100% rename from scaladoc-testcases/docs/docs/docs/f1.md rename to scaladoc-testcases/docs/_docs/docs/f1.md diff --git a/scaladoc-testcases/docs/docs/docs/f2.md b/scaladoc-testcases/docs/_docs/docs/f2.md similarity index 100% rename from scaladoc-testcases/docs/docs/docs/f2.md rename to scaladoc-testcases/docs/_docs/docs/f2.md diff --git a/scaladoc-testcases/docs/docs/docs/f3.md b/scaladoc-testcases/docs/_docs/docs/f3.md similarity index 100% rename from scaladoc-testcases/docs/docs/docs/f3.md rename to scaladoc-testcases/docs/_docs/docs/f3.md diff --git a/scaladoc-testcases/docs/docs/docs/f4.md b/scaladoc-testcases/docs/_docs/docs/f4.md similarity index 100% rename from scaladoc-testcases/docs/docs/docs/f4.md rename to scaladoc-testcases/docs/_docs/docs/f4.md diff --git a/scaladoc-testcases/docs/docs/index.md b/scaladoc-testcases/docs/_docs/index.md similarity index 100% rename from scaladoc-testcases/docs/docs/index.md rename to scaladoc-testcases/docs/_docs/index.md diff --git a/scaladoc-testcases/docs/sidebar.yml b/scaladoc-testcases/docs/sidebar.yml index 6ab7a4936ede..51f8e87f2ad6 100644 --- a/scaladoc-testcases/docs/sidebar.yml +++ b/scaladoc-testcases/docs/sidebar.yml @@ -1,7 +1,6 @@ -sidebar: - - title: Docs - subsection: - - page: docs/docs/f1.md - - page: docs/docs/f2.md - - page: docs/docs/f3.md - - page: docs/docs/f4.md +index: index.md +subsection: + - page: docs/f1.md + - page: docs/f2.md + - page: docs/f3.md + - page: docs/f4.md diff --git a/scaladoc-testcases/src/docs/tests/Adoc.scala b/scaladoc-testcases/src/_docs/tests/Adoc.scala similarity index 59% rename from scaladoc-testcases/src/docs/tests/Adoc.scala rename to scaladoc-testcases/src/_docs/tests/Adoc.scala index af93f9eddfa0..04b2c3918023 100644 --- a/scaladoc-testcases/src/docs/tests/Adoc.scala +++ b/scaladoc-testcases/src/_docs/tests/Adoc.scala @@ -1,4 +1,4 @@ -package docs.tests +package _docs.tests class Adoc: def foo = 123 diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala index b743163eaaf7..d71fe03a9c13 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala @@ -31,32 +31,29 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do val renderedResources = renderResources() super.render() - private def specificResources(page: Page): Set[String] = - page.children.toSet.flatMap(specificResources) ++ (page.content match - case r: ResolvedTemplate => - r.resolved.resources.toSet - case _ => Set.empty - ) - private def renderResources(): Seq[String] = - def siteRoot = staticSite.get.root.toPath - def pathToResource(p: String) = Resource.File(p, siteRoot.resolve(p)) - - def harvestResources(path: String) = - val siteImgPath = siteRoot.resolve(path) - if !Files.exists(siteImgPath) then Nil - else - val allPaths = Files.walk(siteImgPath, FileVisitOption.FOLLOW_LINKS) - val files = allPaths.filter(Files.isRegularFile(_)).iterator().asScala - files.map(p => siteRoot.relativize(p).toString).toList - - val staticResources = staticSite.toSeq.flatMap { _ => - harvestResources("images") ++ harvestResources("resources") - } - - val siteResourcesPaths = allPages.toSet.flatMap(specificResources) ++ staticResources - - val resources = siteResourcesPaths.toSeq.map(pathToResource) ++ allResources(allPages) ++ onlyRenderedResources + import scala.util.Using + import scala.jdk.CollectionConverters._ + // All static site resources need to be in _assets folder + val staticSiteResources = staticSite + .map(_.root.toPath.resolve("_assets").toFile) + .filter(f => f.exists && f.isDirectory) + .toSeq + .flatMap { resourceFile => + resourceFile.listFiles.toSeq.map(_.toPath).flatMap { file => + Using(Files.walk(file)) { stream => + stream.iterator().asScala.toSeq + .map(from => Resource.File(resourceFile.toPath.relativize(from).toString, from)) + }.fold ( + { t => + report.warn(s"Error occured while processing _assets file.", t) + Seq.empty + }, + identity + ) + } + } + val resources = staticSiteResources ++ allResources(allPages) ++ onlyRenderedResources resources.flatMap(renderResource) def mkHead(page: Page): AppliedTag = @@ -124,7 +121,7 @@ class HtmlRenderer(rootPackage: Member, members: Map[DRI, Member])(using ctx: Do ) ) - nav.children match + nav.children.filterNot(_.hidden) match case Nil => isSelected -> div(cls := s"ni ${if isSelected then "expanded" else ""}")(linkHtml()) case children => val nested = children.map(renderNested(_)) diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/Locations.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/Locations.scala index bcdaa2bb5a5a..1c55cb8124e1 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/Locations.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/Locations.scala @@ -34,9 +34,8 @@ trait Locations(using ctx: DocContext): cache.get(dri) match case null => val path = dri match - case `docsRootDRI` => List("docs", "index") case `apiPageDRI` => - if ctx.staticSiteContext.fold(false)(_.hasIndexFile) + if ctx.args.apiSubdirectory && ctx.staticSiteContext.nonEmpty then List("api", "index") else List("index") case dri if dri.isStaticFile => @@ -88,6 +87,6 @@ trait Locations(using ctx: DocContext): def pathToRoot(dri: DRI): String = rawLocation(dri).drop(1).map(_ => "..") match case Nil => "" - case seq => seq.mkString("", "/", "/") + case seq => seq.mkString("", "/" , "/") def driExists(dri: DRI) = effectiveMembers.get(dri).isDefined || dri.isStaticFile diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/Renderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/Renderer.scala index d0b51bf54e6f..45a080d4828a 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/Renderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/Renderer.scala @@ -15,7 +15,7 @@ import java.nio.file.Files import java.nio.file.FileVisitOption import java.io.File -case class Page(link: Link, content: Member | ResolvedTemplate | String, children: Seq[Page]): +case class Page(link: Link, content: Member | ResolvedTemplate | String, children: Seq[Page], hidden: Boolean = false): def withNewChildren(newChildren: Seq[Page]) = copy(children = children ++ newChildren) def withTitle(newTitle: String) = copy(link = link.copy(name = newTitle)) @@ -40,20 +40,12 @@ abstract class Renderer(rootPackage: Member, val members: Map[DRI, Member], prot staticSite match case None => rootPckPage.withTitle(args.name) case Some(siteContext) => - val (indexes, templates) = siteContext.templates.partition(f => - f.templateFile.isIndexPage() && f.file.toPath.getParent() == siteContext.docsPath) - if (indexes.size > 1) - val msg = s"ERROR: Multiple index pages for doc found ${indexes.map(_.file)}" - report.error(msg) + val rootTemplate = siteContext.staticSiteRoot.rootTemplate // Below code is for walking in order the tree and modifing its nodes basing on its neighbours - // First we flatten templates to get them sorted in-order - def flattenedTemplates(template: LoadedTemplate): Seq[LoadedTemplate] = - template +: template.children.flatMap(flattenedTemplates) - // We add dummy guards - val allTemplates: Seq[Option[LoadedTemplate]] = None +: templates.flatMap(flattenedTemplates).map(Some(_)) :+ None + val allTemplates: Seq[Option[LoadedTemplate]] = None +: siteContext.allTemplates.map(Some(_)) :+ None // Let's gather the list of maps for each template with its in-order neighbours val newSettings: List[Map[String, Object]] = allTemplates.sliding(size = 3, step = 1).map { @@ -82,34 +74,17 @@ abstract class Renderer(rootPackage: Member, val members: Map[DRI, Member], prot ) updatedTemplates.result() - val newTemplates = updateSettings(templates, newSettings.to(ListBuffer)) + val newTemplates = updateSettings(Seq(rootTemplate), newSettings.to(ListBuffer)) val templatePages = newTemplates.map(templateToPage(_, siteContext)) - indexes.headOption match - case None if templatePages.isEmpty=> - rootPckPage.withTitle(args.name) - case None => - Page(Link(args.name, docsRootDRI),"", templatePages :+ rootPckPage.withTitle("API")) - case Some(indexPage) => - val newChildren = templatePages :+ rootPckPage.withTitle("API") - templateToPage(indexPage, siteContext).withNewChildren(newChildren) - - val hiddenPages: Seq[Page] = - staticSite match - case None => - Seq(navigablePage.copy( // Add index page that is a copy of api/index.html - link = navigablePage.link.copy(dri = docsRootDRI), - children = Nil - )) - case Some(siteContext) => - // In case that we do not have an index page and we do not have any API entries - // we want to create empty index page, so there is one - val actualIndexTemplate = siteContext.indexTemplate() match { - case None if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate) - case templates => templates.toSeq - } + val newRoot = newTemplates.head - (siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext)) + if newRoot.children.isEmpty && newRoot.templateFile.rawCode.isEmpty + then rootPckPage.withTitle(args.name) + else { + val newRootPage = templateToPage(newRoot, siteContext) + newRootPage.withNewChildren(Seq(rootPckPage.withTitle("API"))) + } val redirectPages: Seq[Page] = staticSite.fold(Seq.empty)(siteContext => siteContext.redirectTemplates.map { case (template, driFrom, driTo) => @@ -121,22 +96,10 @@ abstract class Renderer(rootPackage: Member, val members: Map[DRI, Member], prot * Here we have to retrive index pages from hidden pages and replace fake index pages in navigable page tree. */ val allPages: Seq[Page] = - def traversePages(page: Page): (Page, Seq[Page]) = - val (newChildren, newPagesToRemove): (Seq[Page], Seq[Page]) = page.children.map(traversePages(_)).foldLeft((Seq[Page](), Seq[Page]())) { - case ((pAcc, ptrAcc), (p, ptr)) => (pAcc :+ p, ptrAcc ++ ptr) - } - hiddenPages.find(_.link == page.link) match - case None => - (page.copy(children = newChildren), newPagesToRemove) - case Some(newPage) => - (newPage.copy(children = newChildren), newPagesToRemove :+ newPage) - - val (newNavigablePage, pagesToRemove) = traversePages(navigablePage) - - val all = newNavigablePage +: (hiddenPages.filterNot(pagesToRemove.contains) ++ redirectPages) - // We need to check for conflicts only if we have top-level member called blog or docs + val all = navigablePage +: redirectPages + // We need to check for conflicts only if we have top-level member called docs val hasPotentialConflict = - rootPackage.members.exists(m => m.name.startsWith("docs") || m.name.startsWith("blog")) + rootPackage.members.exists(m => m.name.startsWith("_docs")) if hasPotentialConflict then def walk(page: Page): Unit = diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala index 566ccd81ab62..ad97b19fbb24 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/SiteRenderer.scala @@ -22,7 +22,7 @@ trait SiteRenderer(using DocContext) extends Locations: def templateToPage(t: LoadedTemplate, staticSiteCtx: StaticSiteContext): Page = val dri = staticSiteCtx.driFor(t.file.toPath) val content = ResolvedTemplate(t, staticSiteCtx) - Page(Link(t.templateFile.title.name, dri), content, t.children.map(templateToPage(_, staticSiteCtx))) + Page(Link(t.templateFile.title.name, dri), content, t.children.map(templateToPage(_, staticSiteCtx)), t.hidden) private val HashRegex = "([^#]+)(#.+)".r @@ -37,18 +37,28 @@ trait SiteRenderer(using DocContext) extends Locations: res.headOption.map(pathToPage(pageDri, _) + prefix) def processLocalLink(str: String): String = - Try(URL(str)).map(_ => str).toOption.orElse { - tryAsDri(str) - }.orElse { - Option.when( - Files.exists(Paths.get(content.ctx.root.toPath.toAbsolutePath.toString, str)) - )( - resolveLink(pageDri, str.stripPrefix("/")) - ) - }.getOrElse { - report.warn(s"Unable to resolve link '$str'", content.template.file) - str - } + val staticSiteRootPath = content.ctx.root.toPath.toAbsolutePath + def asValidURL: Option[String] = Try(URL(str)).toOption.map(_ => str) + def asAsset: Option[String] = Option.when( + Files.exists(staticSiteRootPath.resolve("_assets").resolve(str.stripPrefix("/"))) + )( + resolveLink(pageDri, str.stripPrefix("/")) + ) + def asStaticSite: Option[String] = 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 + 2. We check if the link leads to other static site + 3. We check if the link leads to existing asset e.g. images/logo.svg -> /_assets/images/logo.svg + */ + + asValidURL + .orElse(asStaticSite) + .orElse(asAsset) + .getOrElse { + report.warn(s"Unable to resolve link '$str'", content.template.templateFile.file) + str + } def processLocalLinkWithGuard(str: String): String = if str.startsWith("#") || str.isEmpty then diff --git a/scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala b/scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala index ec9ac220b413..c8388a8112bd 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/LoadedTemplate.scala @@ -16,7 +16,8 @@ case class LazyEntry(getKey: String, value: () => String) extends JMapEntry[Stri case class LoadedTemplate( templateFile: TemplateFile, children: List[LoadedTemplate], - file: File): + file: File, + hidden: Boolean = false): private def brief(ctx: StaticSiteContext): String = try @@ -32,7 +33,7 @@ case class LoadedTemplate( lazy val entrySet: JSet[JMapEntry[String, Object]] = val site = templateFile.settings.getOrElse("page", Map.empty).asInstanceOf[Map[String, Object]] site.asJava.entrySet() ++ JSet( - LazyEntry("url", () => ctx.relativePath(LoadedTemplate.this).toString), + LazyEntry("url", () => "/" ++ ctx.pathFromRoot(LoadedTemplate.this).toString), LazyEntry("title", () => templateFile.title.name), LazyEntry("excerpt", () => brief(ctx)) ) diff --git a/scaladoc/src/dotty/tools/scaladoc/site/SidebarParser.scala b/scaladoc/src/dotty/tools/scaladoc/site/SidebarParser.scala index 718ce816d001..9d793c403b2d 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/SidebarParser.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/SidebarParser.scala @@ -6,31 +6,77 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.`type`.TypeReference; import collection.JavaConverters._ import java.util.Optional +import scala.beans._ enum Sidebar: - case Category(title: Option[String], indexPath: Option[String], nested: List[Sidebar]) - case Page(title: Option[String], pagePath: String) + case Category( + title: Option[String], + indexPath: Option[String], + nested: List[Sidebar], + directory: Option[String] + ) + case Page(title: Option[String], pagePath: String, hidden: Boolean) object Sidebar: - case class RawInput(var title: String, var page: String, var index: String, var subsection: JList[RawInput]): - def this() = this("", "", "", JList()) + case class RawInput( + @BeanProperty var title: String, + @BeanProperty var page: String, + @BeanProperty var index: String, + @BeanProperty var subsection: JList[RawInput], + @BeanProperty var directory: String, + @BooleanBeanProperty var hidden: Boolean + ): + def this() = this("", "", "", JList(), "", false) - def setTitle(t: String) = this.title = t - def setPage(p: String) = this.page = p - def setIndex(i: String) = this.index = i - def setSubsection(s: JList[RawInput]) = this.subsection = s + private object RawInputTypeRef extends TypeReference[RawInput] - type RawInnerTpe = JMap[String, JList[RawInput]] - private object RawTypeRef extends TypeReference[RawInnerTpe] + private def toSidebar(r: RawInput)(using CompilerContext): Sidebar = r match + case RawInput(title, page, index, subsection, dir, hidden) if page.nonEmpty && index.isEmpty && subsection.isEmpty() => + Sidebar.Page(Option.when(title.nonEmpty)(title), page, hidden) + case RawInput(title, page, index, subsection, dir, hidden) if page.isEmpty && (!subsection.isEmpty() || !index.isEmpty()) => + Sidebar.Category(Option.when(title.nonEmpty)(title), Option.when(index.nonEmpty)(index), subsection.asScala.map(toSidebar).toList, Option.when(dir.nonEmpty)(dir)) + case RawInput(title, page, index, subsection, dir, hidden) => + report.error(s"Error parsing YAML configuration file.\n$schemaMessage") + Sidebar.Page(None, page, hidden) - private def toSidebar(r: RawInput): Sidebar = r match - case RawInput(title, page, index, subsection) if page.nonEmpty && index.isEmpty && subsection.isEmpty() || title == "Blog" => - Sidebar.Page(Option.when(title.nonEmpty)(title), page) - case RawInput(title, page, index, subsection) if page.isEmpty && !subsection.isEmpty() => - Sidebar.Category(Option.when(title.nonEmpty)(title), Option.when(index.nonEmpty)(index), subsection.asScala.map(toSidebar).toList) + private def schemaMessage: String = + s"""Static site YAML configuration file should comply with the following description: + |The root element of static site needs to be + |`title` and `directory` properties are ignored in root subsection. + | + |: + | title: # optional - Default value is file name. Title can be also set using front-matter. + | index: # optional - If not provided, default empty index template is generated. + | directory: # optional - By default, directory name is title name in kebab case. + | subsection: # optional - If not provided, pages are loaded from the index directory + | - | + | # either index or subsection needs to be present + |: + | title: # optional - Default value is file name. Title can be also set using front-matter. + | page: + | hidden: # optional - Default value is false. + | + |For more information visit: + |https://docs.scala-lang.org/scala3/guides/scaladoc/static-site.html + |""".stripMargin - def load(content: String): Seq[Sidebar] = + def load(content: String | java.io.File)(using CompilerContext): Sidebar.Category = + import scala.util.Try val mapper = ObjectMapper(YAMLFactory()) - val raw: RawInnerTpe = mapper.readValue(content, RawTypeRef) + def readValue = content match + case s: String => mapper.readValue(s, RawInputTypeRef) + case f: java.io.File => mapper.readValue(f, RawInputTypeRef) - raw.get("sidebar").asScala.toList.map(toSidebar) + val root: RawInput = Try(readValue) + .fold( + { e => + report.warn(schemaMessage, e) + new RawInput() + }, + identity + ) + toSidebar(root) match + case c: Sidebar.Category => c + case _ => + report.error(s"Root element is not a subsection.\n$schemaMessage") + Sidebar.Category(None, None, List.empty, None) diff --git a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala index 3610c8163649..9f14442a7dbe 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala @@ -9,6 +9,7 @@ import java.nio.file.Paths import scala.util.Try import collection.JavaConverters._ +import scala.annotation.static class StaticSiteContext( val root: File, @@ -19,63 +20,30 @@ class StaticSiteContext( var memberLinkResolver: String => Option[DRI] = _ => None - private def indexFiles = - val files = List(new File(root, "index.html"), new File(root, "index.md")).filter { _.exists() } + val docsPath = root.toPath.resolve("_docs") + val blogPath = root.toPath.resolve("_blog") - if files.size > 1 then - val msg = s"ERROR: Multiple root index pages found: ${files.map(_.getAbsolutePath)}" - report.error(msg) + val relativizeFrom = if args.apiSubdirectory then docsPath else root.toPath - files.headOption - - def hasIndexFile = indexFiles.nonEmpty - - def emptyIndexTemplate = - val fakeFile = new File(root, "index.html") - LoadedTemplate(emptyTemplate(fakeFile, "index"), List.empty, fakeFile) - - def indexTemplate(): Option[LoadedTemplate] = - indexFiles.flatMap(loadTemplate(_, isBlog = false)) + val siteExtensions = Set(".html", ".md") lazy val layouts: Map[String, TemplateFile] = val layoutRoot = new File(root, "_layouts") val dirs: Array[File] = Option(layoutRoot.listFiles()).getOrElse(Array()) dirs.map { it => loadTemplateFile(it)(using this) }.map { it => it.name -> it }.toMap - lazy val sideBarConfig = - val sidebarFile = root.toPath.resolve("sidebar.yml") - if (!Files.exists(sidebarFile)) None - else Some(Sidebar.load(Files.readAllLines(sidebarFile).asScala.mkString("\n"))) - - lazy val templates: Seq[LoadedTemplate] = - sideBarConfig.fold(loadAllFiles().sortBy(_.templateFile.title.name))(_.map(loadSidebarContent)) - - lazy val orphanedTemplates: Seq[LoadedTemplate] = { - def doFlatten(t: LoadedTemplate): Seq[Path] = - t.file.toPath +: t.children.flatMap(doFlatten) - val mainFiles = templates.flatMap(doFlatten) - - val allPaths = - if !Files.exists(docsPath) then Nil - else Files.walk(docsPath, FileVisitOption.FOLLOW_LINKS).iterator().asScala.toList - - val orphanedFiles = allPaths.filterNot { p => - def name = p.getFileName.toString - def isMain = name == "index.html" || name == "index.md" - mainFiles.contains(p) || (isMain && mainFiles.contains(p.getParent)) - }.filter { p => - val name = p.getFileName.toString - name.endsWith(".md") || name.endsWith(".html") - } - - orphanedFiles.flatMap(p => loadTemplate(p.toFile, isBlog = false)) - } - - lazy val redirectTemplates: Seq[(LoadedTemplate, DRI, DRI)] = { - def doFlatten(t: LoadedTemplate): Seq[LoadedTemplate] = - t +: t.children.flatMap(doFlatten) - val mainFiles = templates.flatMap(doFlatten) - mainFiles.flatMap { loadedTemplate => + lazy val staticSiteRoot: StaticSiteRoot = StaticSiteLoader(root, args)(using this, outerCtx).load() + + lazy val allTemplates = + def process(l: LoadedTemplate): List[LoadedTemplate] = + l +: l.children.flatMap(process) + process(staticSiteRoot.rootTemplate) + /** Handles redirecting from multiple locations to one page + * + * For each entry in redirectFrom setting, create a page which contains code that redirects you to the page where the redirectFrom is defined. + */ + lazy val redirectTemplates: Seq[(LoadedTemplate, DRI, DRI)] = + allTemplates.flatMap { loadedTemplate => val redirectFrom = loadedTemplate.templateFile.settings.getOrElse("page", Map.empty).asInstanceOf[Map[String, Object]].get("redirectFrom") def redirectToTemplate(redirectFrom: String) = val fakeFile = new File(docsPath.toFile, redirectFrom) @@ -87,162 +55,53 @@ class StaticSiteContext( case redirects: List[?] => redirects.asInstanceOf[List[String]].map(redirectToTemplate) }.getOrElse(Nil) } - } - - val docsPath = root.toPath.resolve("docs") - - private def isValidTemplate(file: File): Boolean = - (file.isDirectory && !file.getName.startsWith("_")) || - file.getName.endsWith(".md") || - file.getName.endsWith(".html") - - - private def loadTemplate(from: File, isBlog: Boolean): Option[LoadedTemplate] = - if (!isValidTemplate(from)) None else - try - val topLevelFiles = if isBlog then Seq(from, new File(from, "_posts")) else Seq(from) - val allFiles = topLevelFiles.filter(_.isDirectory).flatMap(_.listFiles()) - val (indexes, children) = allFiles.flatMap(loadTemplate(_, isBlog)).partition(_.templateFile.isIndexPage()) - - def loadIndexPage(): TemplateFile = - indexes match - case Nil => - args.defaultTemplate.fold(emptyTemplate(from, from.getName))(layouts(_).copy(title = TemplateName.FilenameDefined(from.getName))).copy(file = File(from, "index.html")) - case Seq(loadedTemplate) => loadedTemplate.templateFile - case _ => - // TODO (https://github.com/lampepfl/scaladoc/issues/238): provide proper error handling - val msg = s"ERROR: Multiple index pages for $from found in ${indexes.map(_.file)}" - throw new java.lang.RuntimeException(msg) - - val templateFile = if (from.isDirectory) loadIndexPage() else loadTemplateFile(from)(using this) - - def dateFrom(p: LoadedTemplate, default: String = "1900-01-01"): String = - val pageSettings = p.templateFile.settings.get("page").collect{ case m: Map[String @unchecked, _] => m } - pageSettings.flatMap(_.get("date").collect{ case s: String => s}).getOrElse(default) // blogs without date are last - - val processedChildren: Seq[LoadedTemplate] = if !isBlog then children.sortBy(_.templateFile.title.name) else - children.sortBy(dateFrom(_)).reverse - - processedChildren.foreach { child => - val regex = raw"(\d*-\d*-\d*)-(.*)".r - val setDate = dateFrom(child, "") - child.templateFile.name match - case regex(date, name) if date != setDate => - val msg = s"Date $date in blog file: ${child.templateFile.name} doesn't match date from settings: $setDate." - report.warn(msg, from) - case name => - } - - val processedTemplate = // Set provided name as arg in page for `docs` - if templateFile.file.getParentFile.toPath == docsPath && templateFile.isIndexPage() then - if templateFile.title.name != "index" then - report.warn("Property `title` will be overridden by project name", from) - - templateFile.copy(title = TemplateName.FilenameDefined(args.name)) - else templateFile - - Some(LoadedTemplate(processedTemplate, processedChildren.toList, processedTemplate.file)) - catch - case e: RuntimeException => - // TODO (https://github.com/lampepfl/scaladoc/issues/238): provide proper error handling - e.printStackTrace() - None - - private def loadSidebarContent(entry: Sidebar): LoadedTemplate = entry match - case Sidebar.Page(optionTitle, pagePath) => - val isBlog = optionTitle == Some("Blog") - val path = if isBlog then "blog" else - if Files.exists(root.toPath.resolve(pagePath)) then pagePath - else pagePath.stripSuffix(".html") + ".md" - - // val file = root.toPath.resolve(path).toFile - val LoadedTemplate(template, children, file) = loadTemplate(root.toPath.resolve(path).toFile, isBlog).get // Add proper logging if file does not exisits - optionTitle match - case Some(title) => - val newTitle = template.title match - case t: TemplateName.YamlDefined => t - case _: TemplateName.FilenameDefined => TemplateName.SidebarDefined(title) - case t: TemplateName.SidebarDefined => t // should never reach this path - LoadedTemplate(template.copy(settings = template.settings + ("title" -> newTitle.name), title = newTitle), children, file) - case None => - LoadedTemplate(template.copy(settings = template.settings), children, file) - - case Sidebar.Category(optionTitle, optionIndexPath, nested) => - optionIndexPath match - case Some(indexPath) => // There is an index page for section, let's load it - loadSidebarContent(Sidebar.Page(optionTitle, indexPath)).copy(children = nested.map(loadSidebarContent)) - case None => // No index page, let's create default fake file. - val title = optionTitle match - case Some(t) => t - case None => "index" - val sidebarContent = nested.map(loadSidebarContent) - // Heuristic to add section index.html around its child pages. Otherwise we put it in directory named after title of section in top-level - def longestPrefix(s1: String, s2: String): String = s1.zip(s2).takeWhile(Function.tupled(_ == _)).map(_._1).mkString - val sortedNames = sidebarContent.collect { - case t if t.file.getName.reverse.dropWhile(_ != '.').reverse != "index" => - t.file.toPath.toString - }.sorted - def indexPathTemplate(s: String) = Paths.get(root.toString, s, "index.html").toFile - val fakeFile = Option.when(sortedNames.nonEmpty)(sortedNames).map { s => - indexPathTemplate(longestPrefix(s.head, s.last)) - }.filter(_.exists).getOrElse { - indexPathTemplate(s"docs/${title.toLowerCase}") - } - LoadedTemplate( - args.defaultTemplate.fold(emptyTemplate(fakeFile, title))(layouts(_).copy(title = TemplateName.FilenameDefined(title))), - sidebarContent, - fakeFile - ) - - private def loadAllFiles() = - def dir(name: String)= List(new File(root, name)).filter(_.isDirectory) - dir("docs").flatMap(_.listFiles()).flatMap(loadTemplate(_, isBlog = false)) - ++ dir("blog").flatMap(loadTemplate(_, isBlog = true)) def driForLink(loadedTemplateFile: File, link: String): Seq[DRI] = - val pathsDri: Option[Seq[DRI]] = Try { - val baseFile = - if - link.startsWith("/") then root.toPath.resolve(link.drop(1)) - else - val path = loadedTemplateFile.toPath - (if Files.isDirectory(path) then path else path.getParent).resolve(link).normalize - - 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")) - ).flatten.filter(Files.exists(_)) ++ Seq( - Option.when(baseFileName == "index")(baseFile.getParent) - ).flatten).map(driFor) - }.toOption.filter(_.nonEmpty) - pathsDri.getOrElse(memberLinkResolver(link).toList) + def possibleLinks(link: String): Seq[Path] = + // Destination file of template + val templateDestLocation = loadedTemplateFile.toPath + // Source file of template (may not exist - e.g. redirect templates) + val templateSourceLocation = staticSiteRoot.reverseSiteMappings.get(templateDestLocation) + + // Check if link is relative or absolute + if link.startsWith("/") + then Seq(root.toPath.resolve(link.drop(1))) + else Seq(templateDestLocation.getParent.resolve(link).normalize) ++ + templateSourceLocation.map(_.getParent.resolve(link).normalize) + + // Try to strip site extension and create all possible file paths + val fileNames = if siteExtensions.exists(link.endsWith(_)) + then { + val withoutExt = siteExtensions.find(link.endsWith(_)).fold(link)(ext => link.stripSuffix(ext)) + siteExtensions.map(withoutExt + _).toSeq + } + else Seq(link) + + val baseFiles = fileNames.flatMap(possibleLinks) + + // If file exists in source files, map it to destination file. If file exists in destination file, just take it. + val links = baseFiles.flatMap(p => + Option.when(staticSiteRoot.sources.contains(p))(p).map(p => staticSiteRoot.siteMappings(p)) + .orElse(Option.when(staticSiteRoot.dests.contains(p))(p)) + ) + + links match { + case link :: rest => Seq(driFor(link)) + case Nil => memberLinkResolver(link).toSeq + } def driFor(dest: Path): DRI = - val rawFilePath = root.toPath.relativize(dest) + val rawFilePath = relativizeFrom.relativize(dest) val pageName = dest.getFileName.toString val dotIndex = pageName.lastIndexOf('.') val relativePath = - if rawFilePath.startsWith(Paths.get("blog","_posts")) then - val regex = raw"(\d*)-(\d*)-(\d*)-(.*)\..*".r - pageName.toString match - case regex(year, month, day, name) => - rawFilePath.getParent.resolveSibling(Paths.get(year, month, day, name)) - case _ => - val msg = s"Relative path for blog: $rawFilePath doesn't match `yyy-mm-dd-name.md` format." - report.warn(msg, dest.toFile) - rawFilePath.resolveSibling(pageName.substring(0, dotIndex)) - else - if (dotIndex < 0) rawFilePath.resolve("index") - else rawFilePath.resolveSibling(pageName.substring(0, dotIndex)) + if (dotIndex < 0) rawFilePath.resolve("index") + else rawFilePath.resolveSibling(pageName.substring(0, dotIndex)) DRI.forPath(relativePath) - def relativePath(myTemplate: LoadedTemplate) = root.toPath.relativize(myTemplate.file.toPath) + def pathFromRoot(myTemplate: LoadedTemplate) = root.toPath.relativize(myTemplate.file.toPath) val projectWideProperties = Seq("projectName" -> args.name) ++ diff --git a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala new file mode 100644 index 000000000000..0df7fa11c324 --- /dev/null +++ b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala @@ -0,0 +1,207 @@ +package dotty.tools.scaladoc +package site + +import java.io.File +import java.nio.file.Files +import java.nio.file.{ Paths, Path } +import scala.io._ + +class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSiteContext, CompilerContext): + val ctx: StaticSiteContext = summon[StaticSiteContext] + + val possibleYamlFiles: Seq[String] = Seq( + "sidebar.yml" + ) + + def load(): StaticSiteRoot = { + // Check whether there's YAML file defining static site structure + possibleYamlFiles + .map(name => root.toPath.resolve(name)) + .find(path => Files.exists(path)) + .fold(loadBasedOnFileSystem()) { path => + val entries = Sidebar.load(path.toFile) + loadBasedOnYaml(entries) + } + } + + /** Method loading static site structure based on YAML configuration file. + * + * The rendered static site will only contain pages that are present in YAML. + * The following rules are applied: + * - Each subsection will be a separate directory. + * - Nested subsections will result in nested directories. + * - If the subsection object contains location of index and doesn't contain any item, + * items are loaded using file system from the directory of the index file. + * - By default, directory name is a subsection title converted to kebab case. + * However, you can override default name by setting "directory" property of the subsection object. + * + */ + def loadBasedOnYaml(yamlRoot: Sidebar.Category): StaticSiteRoot = { + val rootDest = ctx.docsPath.resolve("index.html").toFile + val rootIndex = yamlRoot.indexPath + .map(ctx.docsPath.resolve(_).toFile) + .filter(_.exists) + .fold(emptyTemplate(rootDest, "index")) { f => + val loaded = loadTemplateFile(f) + if loaded.title.name != "index" + then report.warn("Property `title` will be overridden by project name", f) + loaded + }.copy(title = TemplateName.FilenameDefined(args.name)) + + def loadChild(pathFromRoot: Path): Sidebar => LoadedTemplate = { + case Sidebar.Category(optionTitle, optionIndexPath, nested, dir) => + val indexPageOpt = optionIndexPath + .map(relativizeIfNeeded) + .map(_.toFile) + .filter(_.exists) + .map(loadTemplateFile(_)) + val title = ( + optionTitle.map(TemplateName.SidebarDefined(_)) ++ + indexPageOpt.map(_.title) + ).headOption.getOrElse { + report.error(s"Title for subsection needs to be set in YAML config or in index file") + TemplateName.FilenameDefined("unnamed_section") + } + val categoryPath = dir.fold(pathFromRoot.resolve(toKebabCase(title.name)))(pathFromRoot.resolve(_)) + val indexPage = indexPageOpt.getOrElse(emptyTemplate(categoryPath.resolve("index.html").toFile, title.name)) + + val children = optionIndexPath.filter(_ => nested.isEmpty).fold( + nested.map(child => loadChild(categoryPath)(child)) + ) { indexPath => + val indexPathDirectory = Paths.get(indexPath).getParent + val filesInDirectory = Option(root.toPath.resolve(indexPathDirectory).toFile.listFiles) + filesInDirectory.fold(List.empty) { files => + val mappingFunc: File => File = file => { + val relativeFile = root.toPath.resolve(indexPathDirectory).relativize(file.toPath) + categoryPath.resolve(relativeFile).toFile + } + files.toList + .filter(_.toPath != indexPage.file.toPath) + .flatMap(file => loadRecursively(file, mappingFunc)) + } + } + + LoadedTemplate(indexPage, children, categoryPath.resolve("index.html").toFile) + case Sidebar.Page(optionTitle, pagePath, hidden) => + val path = relativizeIfNeeded(pagePath) + val file = path.toFile + val title = optionTitle.map(TemplateName.SidebarDefined(_)) + val templateFile = loadTemplateFile(file, title) + LoadedTemplate(templateFile, List.empty, pathFromRoot.resolve(file.getName).toFile, hidden) + } + val rootTemplate = LoadedTemplate(rootIndex, yamlRoot.nested.map(c => loadChild(ctx.docsPath)(c)) ++ loadBlog(), rootDest) + val mappings = createMapping(rootTemplate) + StaticSiteRoot(rootTemplate, mappings) + } + + def loadBasedOnFileSystem(): StaticSiteRoot = { + val rootTemplate = + loadRecursively(ctx.docsPath.toFile).getOrElse( + LoadedTemplate(emptyTemplate(ctx.docsPath.resolve("index.html").toFile, "index"), List.empty, ctx.docsPath.resolve("index.html").toFile) + ) + + if rootTemplate.templateFile.title.name != "index" then { + report.warn("Property `title` will be overridden by project name", rootTemplate.templateFile.file) + } + + val withChangedTitle = + rootTemplate.copy(templateFile = rootTemplate.templateFile.copy(title = TemplateName.FilenameDefined(args.name))) + + val withBlog = loadBlog().fold(withChangedTitle)(blog => withChangedTitle.copy(children = withChangedTitle.children :+ blog)) + + val mappings = createMapping(withBlog) + StaticSiteRoot(withBlog, mappings) + } + + def loadBlog(): Option[LoadedTemplate] = { + type Date = (String, String, String) + val rootPath = ctx.blogPath + if (!Files.exists(rootPath)) None + else { + val indexPageOpt = Seq( + rootPath.resolve("index.md"), + rootPath.resolve("index.html"), + ).filter(p => Files.exists(p)) match { + case Nil => None + case indexPath :: Nil => Some(indexPath) + case list => + report.warning(s"Multiple index pages for $rootPath found in ${list.map(_.toFile)}. Defaulting to first.") + list.headOption + } + val indexTemplateOpt = indexPageOpt.map(p => loadTemplateFile(p.toFile)) + + val indexPage = indexTemplateOpt.getOrElse(emptyTemplate(rootPath.resolve("index.html").toFile, "Blog")) + val indexDest = ctx.docsPath.resolve("_blog").resolve("index.html") + val regex = raw"(\d*)-(\d*)-(\d*)-(.*)".r + def splitDateName(tf: TemplateFile): (Date, String) = tf.file.getName match + case regex(year, month, day, name) => ((year, month, day), name) + case name => + report.warn("Incorrect file name for blog post. Post file name should be in format ---", tf.file) + (("1900","01","01"), name) + + def dateFrom(tf: TemplateFile, default: String = "1900-01-01"): String = + val pageSettings = tf.settings.get("page").collect{ case m: Map[String @unchecked, _] => m } + pageSettings.flatMap(_.get("date").collect{ case s: String => s}).getOrElse(default) // blogs without date are last + + val posts = List(rootPath.resolve("_posts")) + .filter(Files.exists(_)) + .flatMap(_.toFile.listFiles) + .filterNot(_.isDirectory) + .map { postFile => + val templateFile = loadTemplateFile(postFile) + val ((year, month, day), name) = splitDateName(templateFile) + val destPath = ctx.docsPath.resolve("_blog").resolve(year).resolve(month).resolve(day).resolve(name) + val date = dateFrom(templateFile, s"$year-$month-$day") + date -> LoadedTemplate(templateFile, List.empty, destPath.toFile) + }.sortBy(_._1).reverse.map(_._2) + + Some(LoadedTemplate(indexPage, posts, indexDest.toFile)) + } + } + + def loadRecursively(currRoot: File, destMappingFunc: File => File = identity): Option[LoadedTemplate] = { + val rootPath = currRoot.toPath + if currRoot.isDirectory + then { + val indexPageOpt = Seq( + rootPath.resolve("index.md"), + rootPath.resolve("index.html"), + rootPath.resolve(s"${currRoot.getName}.md"), + rootPath.resolve(s"${currRoot.getName}.html") + ).filter(p => Files.exists(p)) match { + case Nil => None + case indexPath :: Nil => Some(indexPath) + case list => + report.warning(s"Multiple index pages for $currRoot found in ${list.map(_.toFile)}. Defaulting to first.") + list.headOption + } + val templateFileOpt = indexPageOpt.map(p => loadTemplateFile(p.toFile)) + + val indexPage = templateFileOpt.getOrElse(emptyTemplate(rootPath.resolve("index.html").toFile, "index")) + + val children = currRoot.listFiles.toList + .filter(_.toPath != indexPageOpt.getOrElse(null)) + Some(LoadedTemplate(indexPage, children.flatMap(loadRecursively(_, destMappingFunc)).sortBy(_.templateFile.title.name), destMappingFunc(indexPage.file))) + } + else if (currRoot.exists && ctx.siteExtensions.exists(ext => currRoot.getName.endsWith(ext))) { + val templateFile = loadTemplateFile(currRoot) + Some(LoadedTemplate(templateFile, List.empty, destMappingFunc(templateFile.file))) + } + else None + } + + def createMapping(root: LoadedTemplate): Map[Path, Path] = + Map((root.templateFile.file.toPath, root.file.toPath)) ++ root.children.map(createMapping).fold(Map.empty)(_ ++ _) + + private def toKebabCase(s: String) = s.toLowerCase.replace(' ', '-') + + private def relativizeIfNeeded(link: String): Path = + val path = Paths.get(link) + if !path.isAbsolute then ctx.docsPath.resolve(link) + else path + + extension (p: Path) + private def toHtml: Path = p.getParent.resolve(p.getFileName.toString match + case f if f.endsWith(".md") => f.stripSuffix(".md") + ".html" + case f => f + ) \ No newline at end of file diff --git a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteRoot.scala b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteRoot.scala new file mode 100644 index 000000000000..55c01030d722 --- /dev/null +++ b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteRoot.scala @@ -0,0 +1,12 @@ +package dotty.tools.scaladoc +package site + +import java.nio.file.Path + +case class StaticSiteRoot( + rootTemplate: LoadedTemplate, + siteMappings: Map[Path, Path] +): + lazy val reverseSiteMappings = siteMappings.map(_.swap).toMap + lazy val sources = siteMappings.keys.toSet + lazy val dests = reverseSiteMappings.keys.toSet \ No newline at end of file diff --git a/scaladoc/src/dotty/tools/scaladoc/site/common.scala b/scaladoc/src/dotty/tools/scaladoc/site/common.scala index 6c7677729e89..e409fe4ae636 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/common.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/common.scala @@ -58,7 +58,7 @@ final val LineSeparator = "\n" def yamlParser(using ctx: StaticSiteContext): Parser = Parser.builder(defaultMarkdownOptions).build() -def loadTemplateFile(file: File)(using ctx: StaticSiteContext): TemplateFile = { +def loadTemplateFile(file: File, defaultTitle: Option[TemplateName] = None)(using ctx: StaticSiteContext): TemplateFile = { val lines = Files.readAllLines(file.toPath).asScala.toList val (config, content) = if (lines.head == ConfigSeparator) { @@ -105,7 +105,7 @@ def loadTemplateFile(file: File)(using ctx: StaticSiteContext): TemplateFile = { rawCode = content.mkString(LineSeparator), settings = settings, name = name, - title = stringSetting(allSettings, "title").map(TemplateName.YamlDefined(_)).getOrElse(TemplateName.FilenameDefined(name)), + title = stringSetting(allSettings, "title").map(TemplateName.YamlDefined(_)).orElse(defaultTitle).getOrElse(TemplateName.FilenameDefined(name)), hasFrame = !stringSetting(allSettings, "hasFrame").contains("false"), resources = (listSetting(allSettings, "extraCSS") ++ listSetting(allSettings, "extraJS")).flatten.toList, layout = stringSetting(allSettings, "layout"), diff --git a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala index 55eb30026fd4..8d7cc04cfec6 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/templates.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/templates.scala @@ -16,6 +16,8 @@ import com.vladsch.flexmark.util.options.{DataHolder, MutableDataSet} import com.vladsch.flexmark.html.HtmlRenderer import com.vladsch.flexmark.formatter.Formatter import liqp.Template +import liqp.ParseSettings +import liqp.parser.Flavor import liqp.TemplateContext import liqp.tags.Tag import liqp.nodes.LNode @@ -24,6 +26,13 @@ import scala.collection.JavaConverters._ import scala.io.Source import dotty.tools.scaladoc.snippets._ +/** RenderingContext stores information about defined properties, layouts and sites being resolved + * + * @param properties Map containing defined properties + * @param layouts Map containing defined site layouts + * @param resolving Set containing names of sites being resolved in this context. This information is useful for cycle detection + * @param resources List of resources that need to be appended to sites + */ case class RenderingContext( properties: Map[String, Object], layouts: Map[String, TemplateFile] = Map(), @@ -93,7 +102,8 @@ case class TemplateFile( throw new RuntimeException(s"Cycle in templates involving $file: ${ctx.resolving}") val layoutTemplate = layout.map(name => - ctx.layouts.getOrElse(name, throw new RuntimeException(s"No layouts named $name in ${ctx.layouts}"))) + ctx.layouts.getOrElse(name, throw new RuntimeException(s"No layouts named $name in ${ctx.layouts}")) + ) def asJavaElement(o: Object): Object = o match case m: Map[_, _] => m.transform { @@ -105,7 +115,9 @@ case class TemplateFile( // Library requires mutable maps.. val mutableProperties = new JHashMap(ctx.properties.transform((_, v) => asJavaElement(v)).asJava) - val rendered = Template.parse(this.rawCode).render(mutableProperties) + val parseSettings = ParseSettings.Builder().withFlavor(Flavor.JEKYLL).build() + + val rendered = Template.parse(this.rawCode, parseSettings).render(mutableProperties) // We want to render markdown only if next template is html val code = if (isHtml || layoutTemplate.exists(!_.isHtml)) rendered else @@ -115,7 +127,8 @@ case class TemplateFile( val processed = FlexmarkSnippetProcessor.processSnippets(parsedMd, None, snippetCheckingFunc, withContext = false)(using ssctx.outerCtx) HtmlRenderer.builder(defaultMarkdownOptions).build().render(processed) - if layoutTemplate.isEmpty then - ResolvedPage(code, resources ++ ctx.resources) - else - layoutTemplate.get.resolveInner(ctx.nest(code, file, resources)) + // If we have a layout template, we need to embed rendered content in it. Otherwise, we just leave the content as is. + layoutTemplate match { + case Some(t) => t.resolveInner(ctx.nest(code, file, resources)) + case None => ResolvedPage(code, resources ++ ctx.resources) + } diff --git a/scaladoc/test-documentations/basic/images/basic.svg b/scaladoc/test-documentations/basic/_assets/images/basic.svg similarity index 100% rename from scaladoc/test-documentations/basic/images/basic.svg rename to scaladoc/test-documentations/basic/_assets/images/basic.svg diff --git a/scaladoc/test-documentations/basic/docs/Adoc.md b/scaladoc/test-documentations/basic/_docs/Adoc.md similarity index 100% rename from scaladoc/test-documentations/basic/docs/Adoc.md rename to scaladoc/test-documentations/basic/_docs/Adoc.md diff --git a/scaladoc/test-documentations/basic/docs/dir/index.md b/scaladoc/test-documentations/basic/_docs/dir/index.md similarity index 100% rename from scaladoc/test-documentations/basic/docs/dir/index.md rename to scaladoc/test-documentations/basic/_docs/dir/index.md diff --git a/scaladoc/test-documentations/basic/docs/dir/nested.md b/scaladoc/test-documentations/basic/_docs/dir/nested.md similarity index 100% rename from scaladoc/test-documentations/basic/docs/dir/nested.md rename to scaladoc/test-documentations/basic/_docs/dir/nested.md diff --git a/scaladoc/test-documentations/basic/docs/index.md b/scaladoc/test-documentations/basic/_docs/index.md similarity index 100% rename from scaladoc/test-documentations/basic/docs/index.md rename to scaladoc/test-documentations/basic/_docs/index.md diff --git a/scaladoc/test-documentations/basic/index.md b/scaladoc/test-documentations/basic/index.md deleted file mode 100644 index 2205e0c12d3e..000000000000 --- a/scaladoc/test-documentations/basic/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Basic test ---- -# Header - -[Link to docs](docs/index.html) - -And a text! \ No newline at end of file diff --git a/scaladoc/test-documentations/conflicts-pages/docs/tests/Adoc.md b/scaladoc/test-documentations/conflicts-pages/_docs/tests/Adoc.md similarity index 100% rename from scaladoc/test-documentations/conflicts-pages/docs/tests/Adoc.md rename to scaladoc/test-documentations/conflicts-pages/_docs/tests/Adoc.md diff --git a/scaladoc/test-documentations/conflicts-resources/resources/tests/Adoc.html b/scaladoc/test-documentations/conflicts-resources/_assets/resources/tests/Adoc.html similarity index 100% rename from scaladoc/test-documentations/conflicts-resources/resources/tests/Adoc.html rename to scaladoc/test-documentations/conflicts-resources/_assets/resources/tests/Adoc.html diff --git a/scaladoc/test-documentations/noDocsIndex/images/basic.svg b/scaladoc/test-documentations/noDocsIndex/_assets/images/basic.svg similarity index 100% rename from scaladoc/test-documentations/noDocsIndex/images/basic.svg rename to scaladoc/test-documentations/noDocsIndex/_assets/images/basic.svg diff --git a/scaladoc/test-documentations/noDocsIndex/docs/Adoc.md b/scaladoc/test-documentations/noDocsIndex/_docs/Adoc.md similarity index 100% rename from scaladoc/test-documentations/noDocsIndex/docs/Adoc.md rename to scaladoc/test-documentations/noDocsIndex/_docs/Adoc.md diff --git a/scaladoc/test-documentations/noDocsIndex/docs/dir/index.md b/scaladoc/test-documentations/noDocsIndex/_docs/dir/index.md similarity index 100% rename from scaladoc/test-documentations/noDocsIndex/docs/dir/index.md rename to scaladoc/test-documentations/noDocsIndex/_docs/dir/index.md diff --git a/scaladoc/test-documentations/noDocsIndex/docs/dir/nested.md b/scaladoc/test-documentations/noDocsIndex/_docs/dir/nested.md similarity index 100% rename from scaladoc/test-documentations/noDocsIndex/docs/dir/nested.md rename to scaladoc/test-documentations/noDocsIndex/_docs/dir/nested.md diff --git a/scaladoc/test-documentations/noDocsIndex/docs/index.md b/scaladoc/test-documentations/noDocsIndex/_docs/index.md similarity index 100% rename from scaladoc/test-documentations/noDocsIndex/docs/index.md rename to scaladoc/test-documentations/noDocsIndex/_docs/index.md diff --git a/scaladoc/test-documentations/noDocsIndex/index.md b/scaladoc/test-documentations/noDocsIndex/index.md deleted file mode 100644 index 2205e0c12d3e..000000000000 --- a/scaladoc/test-documentations/noDocsIndex/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Basic test ---- -# Header - -[Link to docs](docs/index.html) - -And a text! \ No newline at end of file diff --git a/scaladoc/test-documentations/noGlobalIndex/images/basic.svg b/scaladoc/test-documentations/noGlobalIndex/_assets/images/basic.svg similarity index 100% rename from scaladoc/test-documentations/noGlobalIndex/images/basic.svg rename to scaladoc/test-documentations/noGlobalIndex/_assets/images/basic.svg diff --git a/scaladoc/test-documentations/noGlobalIndex/docs/Adoc.md b/scaladoc/test-documentations/noGlobalIndex/_docs/Adoc.md similarity index 100% rename from scaladoc/test-documentations/noGlobalIndex/docs/Adoc.md rename to scaladoc/test-documentations/noGlobalIndex/_docs/Adoc.md diff --git a/scaladoc/test-documentations/noGlobalIndex/docs/dir/index.md b/scaladoc/test-documentations/noGlobalIndex/_docs/dir/index.md similarity index 100% rename from scaladoc/test-documentations/noGlobalIndex/docs/dir/index.md rename to scaladoc/test-documentations/noGlobalIndex/_docs/dir/index.md diff --git a/scaladoc/test-documentations/noGlobalIndex/docs/dir/nested.md b/scaladoc/test-documentations/noGlobalIndex/_docs/dir/nested.md similarity index 100% rename from scaladoc/test-documentations/noGlobalIndex/docs/dir/nested.md rename to scaladoc/test-documentations/noGlobalIndex/_docs/dir/nested.md diff --git a/scaladoc/test-documentations/noGlobalIndex/docs/index.md b/scaladoc/test-documentations/noGlobalIndex/_docs/index.md similarity index 100% rename from scaladoc/test-documentations/noGlobalIndex/docs/index.md rename to scaladoc/test-documentations/noGlobalIndex/_docs/index.md diff --git a/scaladoc/test-documentations/noIndexes/images/basic.svg b/scaladoc/test-documentations/noIndexes/_assets/images/basic.svg similarity index 100% rename from scaladoc/test-documentations/noIndexes/images/basic.svg rename to scaladoc/test-documentations/noIndexes/_assets/images/basic.svg diff --git a/scaladoc/test-documentations/noIndexes/docs/Adoc.md b/scaladoc/test-documentations/noIndexes/_docs/Adoc.md similarity index 100% rename from scaladoc/test-documentations/noIndexes/docs/Adoc.md rename to scaladoc/test-documentations/noIndexes/_docs/Adoc.md diff --git a/scaladoc/test-documentations/noIndexes/docs/dir/index.md b/scaladoc/test-documentations/noIndexes/_docs/dir/index.md similarity index 100% rename from scaladoc/test-documentations/noIndexes/docs/dir/index.md rename to scaladoc/test-documentations/noIndexes/_docs/dir/index.md diff --git a/scaladoc/test-documentations/noIndexes/docs/dir/nested.md b/scaladoc/test-documentations/noIndexes/_docs/dir/nested.md similarity index 100% rename from scaladoc/test-documentations/noIndexes/docs/dir/nested.md rename to scaladoc/test-documentations/noIndexes/_docs/dir/nested.md diff --git a/scaladoc/test-documentations/static-links/images/basic.svg b/scaladoc/test-documentations/static-links/_assets/images/basic.svg similarity index 100% rename from scaladoc/test-documentations/static-links/images/basic.svg rename to scaladoc/test-documentations/static-links/_assets/images/basic.svg diff --git a/scaladoc/test-documentations/static-links/docs/Adoc.md b/scaladoc/test-documentations/static-links/_docs/Adoc.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/Adoc.md rename to scaladoc/test-documentations/static-links/_docs/Adoc.md diff --git a/scaladoc/test-documentations/static-links/docs/dir/html.md b/scaladoc/test-documentations/static-links/_docs/dir/html.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/html.md rename to scaladoc/test-documentations/static-links/_docs/dir/html.md diff --git a/scaladoc/test-documentations/static-links/docs/dir/index.md b/scaladoc/test-documentations/static-links/_docs/dir/index.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/index.md rename to scaladoc/test-documentations/static-links/_docs/dir/index.md diff --git a/scaladoc/test-documentations/static-links/docs/dir/name...with..dots..md b/scaladoc/test-documentations/static-links/_docs/dir/name...with..dots..md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/name...with..dots..md rename to scaladoc/test-documentations/static-links/_docs/dir/name...with..dots..md diff --git a/scaladoc/test-documentations/static-links/docs/dir/name.with.md.and.html.md b/scaladoc/test-documentations/static-links/_docs/dir/name.with.md.and.html.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/name.with.md.and.html.md rename to scaladoc/test-documentations/static-links/_docs/dir/name.with.md.and.html.md diff --git a/scaladoc/test-documentations/static-links/docs/dir/nested.md b/scaladoc/test-documentations/static-links/_docs/dir/nested.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/nested.md rename to scaladoc/test-documentations/static-links/_docs/dir/nested.md diff --git a/scaladoc/test-documentations/static-links/docs/dir/nested.svg b/scaladoc/test-documentations/static-links/_docs/dir/nested.svg similarity index 100% rename from scaladoc/test-documentations/static-links/docs/dir/nested.svg rename to scaladoc/test-documentations/static-links/_docs/dir/nested.svg diff --git a/scaladoc/test-documentations/static-links/docs/index.md b/scaladoc/test-documentations/static-links/_docs/index.md similarity index 100% rename from scaladoc/test-documentations/static-links/docs/index.md rename to scaladoc/test-documentations/static-links/_docs/index.md diff --git a/scaladoc/test-documentations/static-links/index.md b/scaladoc/test-documentations/static-links/index.md deleted file mode 100644 index 2205e0c12d3e..000000000000 --- a/scaladoc/test-documentations/static-links/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Basic test ---- -# Header - -[Link to docs](docs/index.html) - -And a text! \ No newline at end of file diff --git a/scaladoc/test/dotty/tools/scaladoc/ReportingTest.scala b/scaladoc/test/dotty/tools/scaladoc/ReportingTest.scala index fc215b1de229..e64eac41ac66 100644 --- a/scaladoc/test/dotty/tools/scaladoc/ReportingTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/ReportingTest.scala @@ -76,11 +76,11 @@ class ReportingTest: val docsRoot = testDocPath.resolve("conflicts-pages").toString checkReportedDiagnostics(_.copy( docsRoot = Some(docsRoot), - tastyFiles = tastyFiles("tests", rootPck = "docs") + tastyFiles = tastyFiles("tests", rootPck = "_docs") )){ diag => assertNoWarning(diag) val Seq(msg) = diag.errorMsgs.map(_.toLowerCase) - Seq("conflict","api", "static", "page", "docs/tests/adoc.html") + Seq("conflict","api", "static", "page", "_docs/tests/adoc.html") .foreach( word => Assert.assertTrue(s"Error message: $msg should contains $word", msg.contains(word)) ) diff --git a/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala b/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala index c8172da4833f..39bd7acf84f6 100644 --- a/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/site/NavigationTest.scala @@ -28,7 +28,7 @@ class NavigationTest extends BaseHtmlTest: NavMenuTestEntry("Nested in a directory", "dir/nested.html", Nil) )), NavMenuTestEntry("Adoc", "Adoc.html", Seq()), - NavMenuTestEntry("API", "../api/index.html", Seq( + NavMenuTestEntry("API", "../index.html", Seq( NavMenuTestEntry("tests.site", "../tests/site.html", Seq( NavMenuTestEntry("BrokenLink", "../tests/site/BrokenLink.html", Nil), NavMenuTestEntry("BrokenLinkWiki", "../tests/site/BrokenLinkWiki.html", Nil), @@ -44,5 +44,5 @@ class NavigationTest extends BaseHtmlTest: )), )) - testNavMenu("docs/Adoc.html", topLevelNav) + testNavMenu("_docs/Adoc.html", topLevelNav) } diff --git a/scaladoc/test/dotty/tools/scaladoc/site/SidebarParserTest.scala b/scaladoc/test/dotty/tools/scaladoc/site/SidebarParserTest.scala index 183bd792b262..72fc6515fdee 100644 --- a/scaladoc/test/dotty/tools/scaladoc/site/SidebarParserTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/site/SidebarParserTest.scala @@ -7,43 +7,49 @@ import org.junit.Assert._ // TODO add negaitve and more details tests class SidebarParserTest: - private val sidebar = """sidebar: - - title: Blog - - title: My title - page: my-page1.md - - page: my-page2.md - - page: my-page3/subsection - - title: Reference - subsection: - - page: my-page3.md - - index: my-page4/index.md - subsection: - - page: my-page4/my-page4.md - - title: My subsection - index: my-page5/index.md - subsection: - - page: my-page5/my-page5.md - - subsection: - - page: my-page7/my-page7.md - - index: my-page6/index.md - subsection: - - index: my-page6/my-page6/index.md - subsection: - - page: my-page6/my-page6/my-page6.md - """ + private val sidebar = + """index: index.md + |subsection: + | - title: My title + | page: my-page1.md + | - page: my-page2.md + | - page: my-page3/subsection + | - title: Reference + | subsection: + | - page: my-page3.md + | hidden: true + | - index: my-page4/index.md + | subsection: + | - page: my-page4/my-page4.md + | - title: My subsection + | index: my-page5/index.md + | subsection: + | - page: my-page5/my-page5.md + | - subsection: + | - page: my-page7/my-page7.md + | - index: my-page6/index.md + | subsection: + | - index: my-page6/my-page6/index.md + | subsection: + | - page: my-page6/my-page6/my-page6.md + """.stripMargin @Test def loadSidebar(): Unit = assertEquals( - Seq( - Sidebar.Page(Some("Blog"), ""), - Sidebar.Page(Some("My title"), "my-page1.md"), - Sidebar.Page(None, "my-page2.md"), - Sidebar.Page(None, "my-page3/subsection"), - Sidebar.Category(Some("Reference"), None, List(Sidebar.Page(None, "my-page3.md"))), - Sidebar.Category(None, Some("my-page4/index.md"), List(Sidebar.Page(None, "my-page4/my-page4.md"))), - Sidebar.Category(Some("My subsection"), Some("my-page5/index.md"), List(Sidebar.Page(None, "my-page5/my-page5.md"))), - Sidebar.Category(None, None, List(Sidebar.Page(None, "my-page7/my-page7.md"))), - Sidebar.Category(None, Some("my-page6/index.md"), List(Sidebar.Category(None, Some("my-page6/my-page6/index.md"), List(Sidebar.Page(None, "my-page6/my-page6/my-page6.md"))))), + Sidebar.Category( + None, + Some("index.md"), + List( + Sidebar.Page(Some("My title"), "my-page1.md", false), + Sidebar.Page(None, "my-page2.md", false), + Sidebar.Page(None, "my-page3/subsection", false), + Sidebar.Category(Some("Reference"), None, List(Sidebar.Page(None, "my-page3.md", true)), None), + Sidebar.Category(None, Some("my-page4/index.md"), List(Sidebar.Page(None, "my-page4/my-page4.md", false)), None), + Sidebar.Category(Some("My subsection"), Some("my-page5/index.md"), List(Sidebar.Page(None, "my-page5/my-page5.md", false)), None), + Sidebar.Category(None, None, List(Sidebar.Page(None, "my-page7/my-page7.md", false)), None), + Sidebar.Category(None, Some("my-page6/index.md"), List(Sidebar.Category(None, Some("my-page6/my-page6/index.md"), List(Sidebar.Page(None, "my-page6/my-page6/my-page6.md", false)), None)), None), + ), + None ), - Sidebar.load(sidebar) + Sidebar.load(sidebar)(using testContext) ) diff --git a/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala b/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala index 7ed53bf2e132..1b3c53aba3c0 100644 --- a/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala +++ b/scaladoc/test/dotty/tools/scaladoc/site/SiteGeneratationTest.scala @@ -14,7 +14,7 @@ import dotty.tools.scaladoc.test.BuildInfo class SiteGeneratationTest extends BaseHtmlTest: def indexLinks(content: DocumentContext) = - content.assertAttr("p a","href", "docs/index.html") + content.assertAttr("p a","href", "_docs/index.html") def checkFile( path: String)( @@ -32,21 +32,18 @@ class SiteGeneratationTest extends BaseHtmlTest: } def testDocPages()(using ProjectContext) = - checkFile("docs/Adoc.html")(title = "Adoc", header = "Header in Adoc", parents = Seq(projectName)) - checkFile("docs/dir/index.html")(title = "A directory", header = "A directory", parents = Seq(projectName)) - checkFile("docs/dir/nested.html")( + checkFile("_docs/Adoc.html")(title = "Adoc", header = "Header in Adoc", parents = Seq(projectName)) + checkFile("_docs/dir/index.html")(title = "A directory", header = "A directory", parents = Seq(projectName)) + checkFile("_docs/dir/nested.html")( title = "Nested in a directory", header = "Nested in a directory", parents = Seq(projectName, "A directory")) def testDocIndexPage()(using ProjectContext) = - checkFile("docs/index.html")(title = projectName, header = s"$projectName in header") - - def testMainIndexPage()(using ProjectContext) = - checkFile("index.html")(title = "Basic test", header = "Header", parents = Seq(), indexLinks) + checkFile("_docs/index.html")(title = projectName, header = s"$projectName in header") def testApiPages( mainTitle: String = "API", parents: Seq[String] = Seq(projectName), - hasToplevelIndexIndex: Boolean = true)(using ProjectContext) = + hasToplevelIndexIndex: Boolean = false)(using ProjectContext) = checkFile((if hasToplevelIndexIndex then "api/" else "" )+ "index.html")( title = mainTitle, header = projectName, @@ -67,16 +64,15 @@ class SiteGeneratationTest extends BaseHtmlTest: def basicTest() = withGeneratedSite(testDocPath.resolve("basic")){ testDocPages() testDocIndexPage() - testMainIndexPage() testApiPages() - withHtmlFile("docs/Adoc.html"){ content => + withHtmlFile("_docs/Adoc.html"){ content => content.assertAttr("p a","href", "../tests/site/SomeClass.html") } withHtmlFile("tests/site/SomeClass.html"){ content => content.assertAttr(".breadcrumbs a","href", - "../../docs/index.html", "../../api/index.html", "../site.html", "SomeClass.html" + "../../_docs/index.html", "../../index.html", "../site.html", "SomeClass.html" ) } } @@ -102,7 +98,7 @@ class SiteGeneratationTest extends BaseHtmlTest: @Test def staticLinking() = withGeneratedSite(testDocPath.resolve("static-links")){ - withHtmlFile("docs/Adoc.html"){ content => + withHtmlFile("_docs/Adoc.html"){ content => content.assertAttr("p a","href", "dir/html.html", "dir/name...with..dots..html",