diff --git a/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala b/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala index c9561d7eb56d..390bc653f246 100644 --- a/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala +++ b/scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala @@ -121,7 +121,7 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings: BooleanSetting("-Ygenerate-inkuire", "Generates InkuireDB and enables Hoogle-like searches", false) val apiSubdirectory: Setting[Boolean] = - BooleanSetting("-Yapi-subdirectory", "Keep all api member inside `api` directory", false) + BooleanSetting("-Yapi-subdirectory", "Put the API documentation pages inside a directory `api/`", false) def scaladocSpecificSettings: Set[Setting[_]] = Set(sourceLinks, syntax, revision, externalDocumentationMappings, socialLinks, skipById, skipByRegex, deprecatedSkipPackages, docRootContent, snippetCompiler, snippetCompilerDebug, generateInkuire) diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala index c35f98c24a6d..bd468273d6c7 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala @@ -64,13 +64,14 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx children = Nil )) case Some(siteContext) => - // In case that we do not have an index page and we do not have any API entries + // 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.indexTemplates() match - case Nil if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate) - case templates => templates + val actualIndexTemplate = siteContext.indexTemplate() match { + case None if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate) + case templates => templates.toSeq + } - (siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext)) + (siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext)) /** * Here we have to retrive index pages from hidden pages and replace fake index pages in navigable page tree. diff --git a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala index 8bf88cf47fee..b2175a9c58ec 100644 --- a/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala +++ b/scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala @@ -25,7 +25,8 @@ class StaticSiteContext( if files.size > 1 then val msg = s"ERROR: Multiple root index pages found: ${files.map(_.getAbsolutePath)}" report.error(msg) - files + + files.headOption def hasIndexFile = indexFiles.nonEmpty @@ -33,7 +34,8 @@ class StaticSiteContext( val fakeFile = new File(root, "index.html") LoadedTemplate(emptyTemplate(fakeFile, "index"), List.empty, fakeFile) - def indexTemplates(): Seq[LoadedTemplate] = indexFiles.flatMap(loadTemplate(_, isBlog = false)) + def indexTemplate(): Option[LoadedTemplate] = + indexFiles.flatMap(loadTemplate(_, isBlog = false)) lazy val layouts: Map[String, TemplateFile] = val layoutRoot = new File(root, "_layouts")