Skip to content

Commit c801013

Browse files
Fix sidebar expansion for "details" doc pages
For instance, in `reference/other-new-features`, `opaques-details.html` doesn't appear in the sidebar but is "linked" to `opaques.html` and therefore should expand the same hierarchy.
1 parent 5498efe commit c801013

File tree

1 file changed

+4
-1
lines changed
  • doc-tool/src/dotty/tools/dottydoc/staticsite

1 file changed

+4
-1
lines changed

doc-tool/src/dotty/tools/dottydoc/staticsite/tags.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,12 @@ object tags {
168168
case None => t.subsection.exists(isParent(_, htmlPath))
169169
}
170170
}
171+
private def replaceSuffix(url: String, suffixes: Iterable[String]): String = {
172+
suffixes.find(url.endsWith(_)).map(url.replace(_, ".html")).getOrElse(url)
173+
}
171174
private def renderTitle(t: Title, pageUrl: String): String = {
172175
if (!t.url.isDefined && t.subsection.nonEmpty) {
173-
val htmlPath = pageUrl.replace(".md", ".html")
176+
val htmlPath = replaceSuffix(pageUrl, Seq("-spec.md", "-details.md", ".md"))
174177
val marker = if (isParent(t, htmlPath)) "class=\"toggled\"" else ""
175178
s"""|<li class="section">
176179
| <a onclick='toggleSection(this);'>${t.title}</a>

0 commit comments

Comments
 (0)