Skip to content

Commit efc6664

Browse files
Hide empty/unspecified projectUrl and projectLogo
The condition `{% if site.projectUrl %}` only filters out `null` values, not empty ones.
1 parent 54fcdb6 commit efc6664

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

doc-tool/src/dotty/tools/dottydoc/DocDriver.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class DocDriver extends Driver {
4141
val siteRoot = new java.io.File(ctx.settings.siteRoot.value)
4242
val projectName = ctx.settings.projectName.value
4343
val projectVersion = ctx.settings.projectVersion.value
44-
val projectUrl = ctx.settings.projectUrl.value
45-
val projectLogo = ctx.settings.projectLogo.value
44+
val projectUrl = Option(ctx.settings.projectUrl.value).filter(_.nonEmpty)
45+
val projectLogo = Option(ctx.settings.projectLogo.value).filter(_.nonEmpty)
4646

4747
if (projectName.isEmpty)
4848
ctx.error(s"Site project name not set. Use `-project <title>` to set the project name")

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ case class DefaultParams(
3939
"posts" -> site.posts.map(_.toMap),
4040
"project" -> site.projectTitle,
4141
"version" -> site.projectVersion,
42-
"projectUrl" -> site.projectUrl,
43-
"logo" -> site.projectLogo,
42+
"projectUrl" -> site.projectUrl.orNull,
43+
"logo" -> site.projectLogo.orNull,
4444
"root" -> site.root
4545
).asJava,
4646

@@ -76,8 +76,8 @@ case class SiteInfo(
7676
baseurl: String,
7777
projectTitle: String,
7878
projectVersion: String,
79-
projectUrl: String,
80-
projectLogo: String,
79+
projectUrl: Option[String],
80+
projectLogo: Option[String],
8181
posts: Array[BlogPost],
8282
root: String
8383
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ case class Site(
3333
root: JFile,
3434
projectTitle: String,
3535
projectVersion: String,
36-
projectUrl: String,
37-
projectLogo: String,
36+
projectUrl: Option[String],
37+
projectLogo: Option[String],
3838
documentation: Map[String, Package]
3939
) extends ResourceFinder {
4040
/** Documentation serialized to java maps */

doc-tool/test/dotty/tools/dottydoc/staticsite/SourceFileOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait SourceFileOps {
1313
import scala.collection.JavaConverters._
1414
val site = new Site(
1515
new java.io.File("doc-tool/resources/"),
16-
"test-site", "v0.1", "http://github.com/lampepfl/dotty", Map.empty
16+
"test-site", "v0.1", Some("http://github.com/lampepfl/dotty"), None, Map.empty
1717
)
1818

1919
def stringToSource(path: String, sourceCode: String): SourceFile = {

0 commit comments

Comments
 (0)