diff --git a/docs/_docs/usage/dottydoc.md b/docs/_docs/usage/dottydoc.md deleted file mode 100644 index f7010a0ab3b8..000000000000 --- a/docs/_docs/usage/dottydoc.md +++ /dev/null @@ -1,260 +0,0 @@ ---- -layout: doc-page -title: Dottydoc [Legacy] ---- - -Dottydoc is a tool to generate a combined documentation and API reference for -your project. - -In previous versions of the Scaladoc tool, there is a big divide between what -is documentation and what is API reference. Dottydoc allows referencing, citing -and rendering parts of your API in your documentation, thus allowing the two to -blend naturally. - -To do this, Dottydoc is very similar to what [Jekyll](http://jekyllrb.com/) -provides in form of static site generation. As you probably guessed, this -whole site was created using Dottydoc. - -Creating a site is just as simple as in Jekyll. The site root contains the -layout of the site and all files placed here will be either considered static, -or processed for template expansion. - -The files that are considered for template expansion must end in `*.{html,md}` -and will from here on be referred to as "template files" or "templates". - -A simple "hello world" site could look something like this: - -``` -├── docs -│ └── getting-started.md -└── index.html -``` - -This will give you a site with the following endpoints: - -``` -_site/index.html -_site/docs/getting-started.html -``` - -Just as with Jekyll, the site is rendered in a `_site` directory. - -Using existing Templates and Layouts -==================================== -Dottydoc uses the [Liquid](https://shopify.github.io/liquid/) templating engine -and provides a number of custom filters and tags specific to Scala -documentation. - -In Dottydoc, all templates can contain YAML front-matter. The front-matter -is parsed and put into the `page` variable available in templates via Liquid. - -To perform template expansion, Dottydoc looks at `layout` in the front-matter. -Here's a simple example of the templating system in action, `index.html`: - -```html ---- -layout: main ---- - -

Hello world!

-``` - -With a simple main template like this: - -{% raw %} -```html - - - Hello, world! - - - {{ content }} - - -``` - -Would result in `{{ content }}` being replaced by `

Hello world!

` from -the `index.html` file. -{% endraw %} - -Layouts must be placed in a `_layouts` directory in the site root: - -``` -├── _layouts -│ └── main.html -├── docs -│ └── getting-started.md -└── index.html -``` - -It is also possible to use one of the [default layouts](#default-layouts) that ship with Dottydoc. - -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 -the form `year-month-day-title.{md,html}`. - -An example of this would be: - -``` -├── blog -│ └── _posts -│ └── 2016-12-05-implicit-function-types.md -└── index.html -``` - -To be rendered as templates, each blog post should have front-matter and a -`layout` declaration. - -The posts are also available in the variable `site.subpages` throughout the site. -The fields of these objects are the same as in -`[BlogPost](dotty.tools.dottydoc.staticsite.BlogPost)`. - -Includes -======== -In Liquid, there is a concept of include tags, these are used in templates to -include other de facto templates: - -```html -
- {% raw %}{% include "sidebar.html" %}{% endraw %} -
-``` - -You can leave out the file extension if your include ends in `.html`. - -Includes need to be kept in `_includes` in the site root. Dottydoc provides a -couple of [default includes](#default-includes), but the user-specified -includes may override these. - -An example structure with an include file "sidebar.html": - -``` -├── _includes -│ └── sidebar.html -├── blog -│ ├── _posts -│ │ └── 2016-12-05-implicit-function-types.md -│ └── index.md -└── index.html -``` - -Sidebar -======= -Dottydoc gives you the ability to create your own custom table of contents, -this can either be achieved by overriding the `toc.html` or by -providing a `sidebar.yml` file in the site root: - -```yaml -sidebar: - - title: Blog - url: blog/index.html - - title: Docs - url: docs/index.html - - title: Usage - subsection: - - title: Dottydoc - url: docs/usage/dottydoc.html - - title: sbt-projects - url: docs/usage/sbt-projects.html -``` - -The `sidebar` key is mandatory, as well as `title` for each element. The -default table of contents allows you to have subsections - albeit the current -depth limit is 2 -- we would love to see this changed, contributions welcome! - -The items which have the `subsection` key, may not have a `url` key in the -current scheme. A site root example with this could be: - -``` -├── blog -│ └── _posts -│ └── 2016-12-05-implicit-function-types.md -├── index.html -└── sidebar.yml -``` - -Dottydoc Specific Tags and Behavior -==================================== -Linking to API --------------- -If you for instance, want to link to `scala.collection.immutable.Seq` in a -markdown file, you can simply use the canonical path in your url: - -```markdown -[Seq](scala.collection.immutable.Seq) -``` - -Linking to members is done in the same fashion: - -```markdown -[Seq](scala.collection.immutable.Seq.isEmpty) -``` - -Dottydoc denotes objects by ending their names in "$". To select `List.range` -you'd therefore write: - -```markdown -[List.range](scala.collection.immutable.List$.range) -``` - -Rendering Docstrings --------------------- -Sometimes you end up duplicating the docstring text in your documentation, -therefore Dottydoc makes it easy to render this inline: - -```html -{% raw %}{% docstring "scala.collection.immutable.Seq" %}{% endraw %} -``` - -Other extensions ----------------- -We would love to have your feedback on what you think would be good in order to -render the documentation you want! Perhaps you would like to render method -definitions or members? Let us know by filing -[issues](https://github.com/lampepfl/dotty/issues/new)! - -Default Layouts -=============== -main.html ---------- -A wrapper for all other layouts, includes a default `` with included -JavaScripts and CSS style-sheets. - -### Variables ### -* `content`: placed in `` tag -* `extraCSS`: a list of relative paths to extra CSS style-sheets for the site -* `extraJS`: a list of relative paths to extra JavaScripts for the site -* `title`: the `` of the page - -sidebar.html ------------- -Sidebar uses `main.html` as its parent layout. It adds a sidebar generated from -a YAML file (if exists), as well as the index for the project API. - -### Variables ### -* `content`: placed in a `<div>` with class `content-body` -* `docs`: the API docs generated from supplied source files, this is included by - default and does not need to be specified. - -doc-page.html -------------- -Doc page is used for pages that need a sidebar and provides a small wrapper for -the included {% raw %}`{{ content}}`{% endraw %}. - -api-page.html -------------- -The last two layouts are special, in that they are treated specially by -Dottydoc. The input to the API page is a documented -`[Entity](dotty.tools.dottydoc.model.Entity)`. As such, this page can be changed -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. - -Default Includes -================ -* `scala-logo.svg`: the scala in Dotty version as svg -* `toc.html`: the default table of contents template diff --git a/docs/_docs/usage/version-numbers.md b/docs/_docs/usage/version-numbers.md deleted file mode 100644 index 660cba4509c7..000000000000 --- a/docs/_docs/usage/version-numbers.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: doc-page -title: "Version numbers" ---- - -**This documentation is outdated! Please find the newer version [here](../contributing/procedures/release.md)**. - -Dotty uses multiple schemes for version numbering. - -Stable releases have version numbers of the form `0.${x}.${y}`, where `x` is a main version and `y` is a bug-fix update id. - -Release candidates version numbers have the form `0.${x}.${y}-RC${z}`. -Every 6 weeks, the latest release candidate is promoted to stable and becomes version `0.${x}.${y}`. -The release candidates let library authors test their code in advance of each -release. Multiple release candidates may be released during each 6 weeks -period to fix regressions and are differentiated by `z`. - -Nightlies have version numbers of the form `0.${x}.${y}-bin-${date}-${sha}-NIGHTLY`. -Every 6 weeks, the latest nightly is promoted to release candidate becomes version `0.${x}.${y}-RC1`. diff --git a/docs/_docs/usage/worksheet-mode-implementation-details.md b/docs/_docs/usage/worksheet-mode-implementation-details.md deleted file mode 100644 index 17c1cc3a2430..000000000000 --- a/docs/_docs/usage/worksheet-mode-implementation-details.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -layout: doc-page -title: "Worksheet Mode - Implementation details" - - - - ---- - - -In brief, the worksheets extend the Language Server Protocol and rely on the -Dotty REPL to evaluate code. - -## Evaluation -Each of the individual expressions and statements of the worksheet is extracted -and passed to the Dotty REPL. After the REPL has finished evaluating one unit of -input, it emits a special delimiter that indicates the end of the output for -this input. (See `dotty.tools.languageserver.worksheet.InputStreamConsumer`) - -This process continues until all input has been evaluated. - -The Dotty REPL is run in a separate JVM. The `Evaluator` (see -`dotty.tools.languageserver.worksheet.Evaluator`) will re-use a JVM if the -configuration of the project hasn't changed. - -## Communication with the client -The worksheets extend the Language Server Protocol and add one request and one -notification. - -### Run worksheet request -The worksheet run request is sent from the client to the server to request that -the server runs a given worksheet and streams the result. - -*Request:* - - - method: `worksheet/run` - - params: `WorksheetRunParams` defined as follows: - ```typescript - interface WorksheetRunParams { - /** - * The worksheet to evaluate. - */ - textDocument: VersionedTextDocumentIdentifier; - } - ``` - -*Response:* - - - result: `WorksheetRunResult` defined as follows: - ```typescript - interface WorksheetRunResult { - /** - * Indicates whether evaluation was successful. - */ - success: boolean; - } - ``` - -### Worksheet output notification -The worksheet output notification is sent from the server to the client to -indicate that worksheet execution has produced some output. - -*Notification:* - - - method: `worksheet/publishOutput` - - params: `WorksheetRunOutput` defined as follows: - ```typescript - interface WorksheetRunOutput { - /** - * The worksheet that produced this output. - */ - textDocument: VersionedTextDocumentIdentifier; - - /** - * The range of the expression that produced this output. - */ - range: Range; - - /** - * The output that has been produced. - */ - content: string; - } - ``` diff --git a/docs/sidebar.yml b/docs/sidebar.yml index 95786121e8f4..a909225f4246 100644 --- a/docs/sidebar.yml +++ b/docs/sidebar.yml @@ -3,159 +3,32 @@ subsection: - title: Usage directory: docs/usage index: usage/index.md - subsection: - - 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 directory: docs/reference index: reference/overview.md subsection: - title: New Types index: reference/new-types/new-types.md - subsection: - - 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: reference/enums/enums-index.md - subsection: - - page: reference/enums/enums.md - - page: reference/enums/adts.md - - page: reference/enums/desugarEnums.md - title: Contextual Abstractions index: reference/contextual/contextual.md directory: contextual - subsection: - - 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: reference/metaprogramming/metaprogramming.md - subsection: - - 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: reference/other-new-features/other-new-types.md - subsection: - - 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 directory: changed-features index: reference/changed-features/changed-features.md - subsection: - - 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: reference/dropped-features/dropped-features.md - subsection: - - 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 index: reference/experimental/overview.md - subsection: - - 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/main-annotation.md - - page: reference/experimental/cc.md - - page: reference/experimental/tupled-function.md - page: reference/syntax.md - title: Language Versions index: reference/language-versions/language-versions.md - subsection: - - 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 @@ -180,19 +53,5 @@ subsection: - title: Internals directory: docs/internals index: internals/index.md - subsection: - - 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 - - page: internals/gadts.md - page: release-notes-0.1.2.md hidden: true diff --git a/project/resources/referenceReplacements/sidebar.yml b/project/resources/referenceReplacements/sidebar.yml index 680b44d353d4..5c08e264a677 100644 --- a/project/resources/referenceReplacements/sidebar.yml +++ b/project/resources/referenceReplacements/sidebar.yml @@ -2,138 +2,25 @@ index: reference/overview.md subsection: - title: New Types index: reference/new-types/new-types.md - subsection: - - 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: reference/enums/enums-index.md - subsection: - - page: reference/enums/enums.md - - page: reference/enums/adts.md - - page: reference/enums/desugarEnums.md - title: Contextual Abstractions index: reference/contextual/contextual.md directory: contextual - subsection: - - 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: reference/metaprogramming/metaprogramming.md - subsection: - - 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: reference/other-new-features/other-new-types.md - subsection: - - 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 directory: changed-features index: reference/changed-features/changed-features.md - subsection: - - 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: reference/dropped-features/dropped-features.md - subsection: - - 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 index: reference/experimental/overview.md - subsection: - - 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/main-annotation.md - - page: reference/experimental/cc.md - page: reference/syntax.md - title: Language Versions index: reference/language-versions/language-versions.md - subsection: - - page: reference/language-versions/source-compatibility.md - - page: reference/language-versions/binary-compatibility.md - page: reference/soft-modifier.md - page: reference/features-classification.md diff --git a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala index c9ace108c9b2..767ee2833e9a 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala @@ -5,6 +5,7 @@ import java.io.File import java.nio.file.Files import java.nio.file.{ Paths, Path } import scala.io._ +import scala.util.chaining._ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSiteContext, CompilerContext): val ctx: StaticSiteContext = summon[StaticSiteContext] @@ -69,15 +70,16 @@ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSite nested.map(child => loadChild(categoryPath)(child)) ) { indexPath => val indexPathDirectory = Paths.get(indexPath).getParent - val filesInDirectory = Option(root.toPath.resolve(indexPathDirectory).toFile.listFiles) + val filesInDirectory = Option(ctx.docsPath.resolve(indexPathDirectory).toFile.listFiles) filesInDirectory.fold(List.empty) { files => val mappingFunc: File => File = file => { - val relativeFile = root.toPath.resolve(indexPathDirectory).relativize(file.toPath) + val relativeFile = ctx.docsPath.resolve(indexPathDirectory).relativize(file.toPath) categoryPath.resolve(relativeFile).toFile } files.toList .filter(_.toPath != indexPage.file.toPath) .flatMap(file => loadRecursively(file, mappingFunc)) + .sorted } } @@ -182,6 +184,7 @@ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSite val children = currRoot.listFiles.toList .filter(_.toPath != indexPageOpt.getOrElse(null)) + .sorted 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))) { @@ -201,8 +204,13 @@ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSite if !path.isAbsolute then ctx.docsPath.resolve(link) else path + private given templatesOrdering: Ordering[LoadedTemplate] = + Ordering.by { (t: LoadedTemplate) => + (t.children.size, t.templateFile.title.name) + }(using Ordering.Tuple2(Ordering.Int.reverse, Ordering.String)) + 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 + )