Skip to content

Commit 02b82b6

Browse files
committed
Fixes that should go into #13130
1 parent 49f2d03 commit 02b82b6

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings:
121121
BooleanSetting("-Ygenerate-inkuire", "Generates InkuireDB and enables Hoogle-like searches", false)
122122

123123
val apiSubdirectory: Setting[Boolean] =
124-
BooleanSetting("-Yapi-subdirectory", "Keep all api member inside `api` directory", false)
124+
BooleanSetting("-Yapi-subdirectory", "Put the API documentation pages inside a directory `api/`", false)
125125

126126
def scaladocSpecificSettings: Set[Setting[_]] =
127127
Set(sourceLinks, syntax, revision, externalDocumentationMappings, socialLinks, skipById, skipByRegex, deprecatedSkipPackages, docRootContent, snippetCompiler, snippetCompilerDebug, generateInkuire)

scaladoc/src/dotty/tools/scaladoc/renderers/HtmlRenderer.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ class HtmlRenderer(rootPackage: Member, val members: Map[DRI, Member])(using ctx
6464
children = Nil
6565
))
6666
case Some(siteContext) =>
67-
// In case that we do not have an index page and we do not have any API entries
67+
// In case that we do not have an index page and we do not have any API entries
6868
// we want to create empty index page, so there is one
69-
val actualIndexTemplate = siteContext.indexTemplates() match
70-
case Nil if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate)
71-
case templates => templates
69+
val actualIndexTemplate = siteContext.indexTemplate() match {
70+
case None if effectiveMembers.isEmpty => Seq(siteContext.emptyIndexTemplate)
71+
case templates => templates.toSeq
72+
}
7273

73-
(siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext))
74+
(siteContext.orphanedTemplates ++ actualIndexTemplate).map(templateToPage(_, siteContext))
7475

7576
/**
7677
* Here we have to retrive index pages from hidden pages and replace fake index pages in navigable page tree.

scaladoc/src/dotty/tools/scaladoc/site/StaticSiteContext.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ class StaticSiteContext(
2525
if files.size > 1 then
2626
val msg = s"ERROR: Multiple root index pages found: ${files.map(_.getAbsolutePath)}"
2727
report.error(msg)
28-
files
28+
29+
files.headOption
2930

3031
def hasIndexFile = indexFiles.nonEmpty
3132

3233
def emptyIndexTemplate =
3334
val fakeFile = new File(root, "index.html")
3435
LoadedTemplate(emptyTemplate(fakeFile, "index"), List.empty, fakeFile)
3536

36-
def indexTemplates(): Seq[LoadedTemplate] = indexFiles.flatMap(loadTemplate(_, isBlog = false))
37+
def indexTemplate(): Option[LoadedTemplate] =
38+
indexFiles.flatMap(loadTemplate(_, isBlog = false))
3739

3840
lazy val layouts: Map[String, TemplateFile] =
3941
val layoutRoot = new File(root, "_layouts")

0 commit comments

Comments
 (0)