Skip to content

Commit

Permalink
Fix picking default syntax for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pikinier20 committed Mar 21, 2022
1 parent c9d33a8 commit e3f81bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -52,4 +56,4 @@ object CommentSyntaxArgs:
)
CommentSyntaxArgs(res)
}
}
}

0 comments on commit e3f81bc

Please sign in to comment.