From 807cf8c078bad327992cdcdeac7ebf18695e9aeb Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 15 Jul 2022 20:38:14 +0000 Subject: [PATCH 1/3] Add /api path to site that forwards to API url --- .../typelevel/sbt/TypelevelSitePlugin.scala | 3 ++- .../sbt/site/TypelevelHeliumExtensions.scala | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala index d3d8558a..c1e8fc67 100644 --- a/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala +++ b/site/src/main/scala/org/typelevel/sbt/TypelevelSitePlugin.scala @@ -120,7 +120,8 @@ object TypelevelSitePlugin extends AutoPlugin { tlSiteHeliumExtensions := TypelevelHeliumExtensions( licenses.value.headOption, tlSiteRelatedProjects.value, - tlIsScala3.value + tlIsScala3.value, + tlSiteApiUrl.value ), tlSiteApiUrl := { val javadocioUrl = for { diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 214b633d..0dcda32e 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -33,11 +33,20 @@ import java.net.URL object TypelevelHeliumExtensions { - @deprecated("Use overload with scala3 parameter", "0.4.7") + @deprecated("Use overload with API url and scala3 parameter", "0.4.7") def apply(license: Option[(String, URL)], related: Seq[(String, URL)]): ThemeProvider = apply(license, related, false) + @deprecated("Use overload with API url and scala3 parameter", "0.4.7") + def apply( + license: Option[(String, URL)], + related: Seq[(String, URL)], + scala3: Boolean): ThemeProvider = + apply(license, related, false, None) + /** + * @param apiUrl + * url to API docs * @param license * name and [[java.net.URL]] of project license * @param related @@ -48,7 +57,8 @@ object TypelevelHeliumExtensions { def apply( license: Option[(String, URL)], related: Seq[(String, URL)], - scala3: Boolean + scala3: Boolean, + apiUrl: Option[URL] ): ThemeProvider = new ThemeProvider { def build[F[_]](implicit F: Sync[F]): Resource[F, Theme[F]] = ThemeBuilder[F]("Typelevel Helium Extensions") @@ -62,6 +72,11 @@ object TypelevelHeliumExtensions { F.blocking(getClass.getResourceAsStream("helium/site/styles.css")), Path.Root / "site" / "styles.css" ) + .merge( + apiUrl.fold(InputTree[F]) { url => + InputTree[F].addString(htmlForwarder(url), Path.Root / "api" / "index.html") + } + ) ) .addExtensions( GitHubFlavor, @@ -93,4 +108,11 @@ object TypelevelHeliumExtensions { }) .build + private def htmlForwarder(to: URL) = + s"""| + | + | + | + |""".stripMargin + } From 4a5b58d05b2c8529d971d8ef740b384e488854b8 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 15 Jul 2022 20:39:56 +0000 Subject: [PATCH 2/3] Fix deprecated-since version --- .../org/typelevel/sbt/site/TypelevelHeliumExtensions.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 0dcda32e..09ad3b2e 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -37,7 +37,7 @@ object TypelevelHeliumExtensions { def apply(license: Option[(String, URL)], related: Seq[(String, URL)]): ThemeProvider = apply(license, related, false) - @deprecated("Use overload with API url and scala3 parameter", "0.4.7") + @deprecated("Use overload with API url and scala3 parameter", "0.4.13") def apply( license: Option[(String, URL)], related: Seq[(String, URL)], From 0e3a2de3a4c5e0f1f6e015aa32fb85a334cb74a7 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Fri, 15 Jul 2022 20:42:11 +0000 Subject: [PATCH 3/3] Fix scaladoc ordering --- .../org/typelevel/sbt/site/TypelevelHeliumExtensions.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala index 09ad3b2e..2e5d468f 100644 --- a/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala +++ b/site/src/main/scala/org/typelevel/sbt/site/TypelevelHeliumExtensions.scala @@ -45,14 +45,14 @@ object TypelevelHeliumExtensions { apply(license, related, false, None) /** - * @param apiUrl - * url to API docs * @param license * name and [[java.net.URL]] of project license * @param related * name and [[java.net.URL]] of related projects * @param scala3 * whether to use Scala 3 syntax highlighting + * @param apiUrl + * url to API docs */ def apply( license: Option[(String, URL)],