From e3f81bc0433e2d5940689478e74843c85fa90054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Zyba=C5=82a?= Date: Mon, 21 Mar 2022 11:24:32 +0100 Subject: [PATCH] Fix picking default syntax for comments --- project/Build.scala | 3 ++- .../tools/scaladoc/tasty/comments/CommentSyntaxArgs.scala | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/project/Build.scala b/project/Build.scala index 6099769756ff..752841a67b59 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1839,7 +1839,8 @@ object ScaladocConfigs { .add(DocRootContent(docRootFile.toString)) .add(CommentSyntax(List( s"${dottyLibRoot}=markdown", - s"${stdLibRoot}=wiki" + s"${stdLibRoot}=wiki", + "wiki" ))) .add(VersionsDictionaryUrl("https://scala-lang.org/api/versions.json")) .add(DocumentSyntheticTypes(true)) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/CommentSyntaxArgs.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/CommentSyntaxArgs.scala index 65bacba3cd2d..34b489833dd4 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/comments/CommentSyntaxArgs.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/comments/CommentSyntaxArgs.scala @@ -17,10 +17,14 @@ object CommentSyntax: val default = CommentSyntax.Markdown case class CommentSyntaxArgs(csFormats: PathBased[CommentSyntax]): + val defaultSyntax = csFormats.get(csFormats.projectRoot) + .map(_.elem) + .getOrElse(CommentSyntax.default) + def get(path: Option[Path]): CommentSyntax = path .flatMap(p => csFormats.get(p).map(_.elem)) - .getOrElse(CommentSyntax.default) + .getOrElse(defaultSyntax) object CommentSyntaxArgs: val usage = @@ -52,4 +56,4 @@ object CommentSyntaxArgs: ) CommentSyntaxArgs(res) } - } \ No newline at end of file + }