From c126f28a5608ea799c8eb94bf38a5c12d83e9fad Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Wed, 23 Dec 2020 18:12:00 +0100 Subject: [PATCH 1/4] Removes tut --- build.sbt | 1 - project/plugins.sbt | 1 - src/main/scala/microsites/MicrositeKeys.scala | 39 ++----------------- .../scala/microsites/MicrositesPlugin.scala | 7 +--- .../microsites/change-default-paths/build.sbt | 2 +- .../microsites/extra-md-files/build.sbt | 1 - src/sbt-test/microsites/tut-compile/README.md | 24 ------------ src/sbt-test/microsites/tut-compile/build.sbt | 13 ------- .../tut-compile/project/plugins.sbt | 2 - .../tut-compile/src/main/tut/docs.md | 24 ------------ src/sbt-test/microsites/tut-compile/test | 14 ------- 11 files changed, 6 insertions(+), 122 deletions(-) delete mode 100644 src/sbt-test/microsites/tut-compile/README.md delete mode 100644 src/sbt-test/microsites/tut-compile/build.sbt delete mode 100644 src/sbt-test/microsites/tut-compile/project/plugins.sbt delete mode 100644 src/sbt-test/microsites/tut-compile/src/main/tut/docs.md delete mode 100644 src/sbt-test/microsites/tut-compile/test diff --git a/build.sbt b/build.sbt index 39dfdacc..f98984fa 100644 --- a/build.sbt +++ b/build.sbt @@ -36,7 +36,6 @@ lazy val documentation = project .enablePlugins(MdocPlugin) lazy val pluginSettings: Seq[Def.Setting[_]] = Seq( - addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13"), addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.13"), addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3"), addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1"), diff --git a/project/plugins.sbt b/project/plugins.sbt index ded6048b..2e227389 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,7 +5,6 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0") -addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") diff --git a/src/main/scala/microsites/MicrositeKeys.scala b/src/main/scala/microsites/MicrositeKeys.scala index 6753bf8c..bd7256a9 100644 --- a/src/main/scala/microsites/MicrositeKeys.scala +++ b/src/main/scala/microsites/MicrositeKeys.scala @@ -35,7 +35,6 @@ import sbt.Keys._ import sbt._ import sbt.complete.DefaultParsers.OptNotSpace import sbt.io.{IO => FIO} -import tut.TutPlugin.autoImport._ import scala.concurrent.ExecutionContext import scala.sys.process._ @@ -52,10 +51,6 @@ trait MicrositeKeys { final case object GHPagesPlugin extends PushWith("ghPagesPlugin") final case object GitHub4s extends PushWith("github4s") - sealed abstract class CompilingDocsTool extends Product with Serializable - final case object WithTut extends CompilingDocsTool - final case object WithMdoc extends CompilingDocsTool - object GitHostingService { implicit def string2GitHostingService(name: String): GitHostingService = { List(GitHub, GitLab, Bitbucket) @@ -71,11 +66,8 @@ trait MicrositeKeys { } val makeMicrosite: TaskKey[Unit] = taskKey[Unit]("Main task to build a microsite") - val makeTut: TaskKey[Unit] = taskKey[Unit]("Sequential tasks to compile tut and move the result") val makeMdoc: TaskKey[Unit] = taskKey[Unit]("Sequential tasks to compile mdoc and move the result") - val makeDocs: TaskKey[Unit] = - taskKey[Unit]("Dynamic task that will evaluate makeTut or makeMdoc depending on setting") val createMicrositeVersions: TaskKey[Unit] = taskKey[Unit]( "Task to create the different microsites going through the list specified in the settings" @@ -102,8 +94,6 @@ trait MicrositeKeys { val microsite: TaskKey[Seq[File]] = taskKey[Seq[File]]("Create microsite files") val micrositeMakeExtraMdFiles: TaskKey[File] = taskKey[File]("Create microsite extra md files") - val micrositeTutExtraMdFiles: TaskKey[Seq[File]] = - taskKey[Seq[File]]("Run tut for extra microsite md files") val micrositeName: SettingKey[String] = settingKey[String]("Microsite name") val micrositeDescription: SettingKey[String] = settingKey[String]("Microsite description") val micrositeAuthor: SettingKey[String] = settingKey[String]("Microsite author") @@ -156,7 +146,7 @@ trait MicrositeKeys { ) val micrositeExtraMdFiles: SettingKey[Map[File, ExtraMdFileConfig]] = settingKey[Map[File, ExtraMdFileConfig]]( - "Optional. This key is useful when you want to include automatically markdown documents as a part of your microsite, and these files are located in different places from the tutSourceDirectory. The map key is related with the source file, the map value corresponds with the target relative file path and the document meta-information configuration. By default, the map is empty." + "Optional. This key is useful when you want to include automatically markdown documents as a part of your microsite, and these files are located in different places. The map key is related with the source file, the map value corresponds with the target relative file path and the document meta-information configuration. By default, the map is empty." ) val micrositeExtraMdFilesOutput: SettingKey[File] = settingKey[File]( "Optional. Microsite output location for extra-md files. Default is resourceManaged + '/jekyll/extra_md'" @@ -214,9 +204,6 @@ trait MicrositeKeys { "Optional. Add a button in DocsLayout pages that links to the file in the repository." ) - val micrositeCompilingDocsTool = - settingKey[CompilingDocsTool]("Choose between compiling code snippets with tut or mdoc") - val micrositeTheme: SettingKey[String] = settingKey[String]( "Optional. 'light' by default. Set it to 'pattern' to generate the pattern theme design." ) @@ -320,7 +307,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys { "style" -> "compressed", "sourcemap" -> "never" ), - "collections" -> Map("tut" -> Map("output" -> true)) + "collections" -> Map("mdoc" -> Map("output" -> true)) ) val userCustomVariables = micrositeConfigYaml.value @@ -401,28 +388,10 @@ trait MicrositeAutoImportSettings extends MicrositeKeys { microsite := micrositeHelper.value .createResources(resourceManagedDir = (resourceManaged in Compile).value), micrositeMakeExtraMdFiles := micrositeHelper.value.buildAdditionalMd(), - micrositeTutExtraMdFiles := { - val r = (runner in Tut).value - val in = micrositeMakeExtraMdFiles.value - val out = tutTargetDirectory.value - val cp = (fullClasspath in Tut).value - val opts = (scalacOptions in Tut).value - val pOpts = tutPluginJars.value.map(f => "–Xplugin:" + f.getAbsolutePath) - val re = tutNameFilter.value.pattern.toString - _root_.tut.TutPlugin.tutOne(streams.value, r, in, out, cp, opts, pOpts, re).map(_._1) - }, - makeTut := - Def.sequential(tut, micrositeTutExtraMdFiles).value, makeMdoc := Def.sequential(mdoc.toTask(""), micrositeMakeExtraMdFiles).value, - makeDocs := Def.taskDyn { - micrositeCompilingDocsTool.value match { - case WithTut => Def.sequential(makeTut) - case WithMdoc => Def.sequential(makeMdoc) - } - }.value, makeMicrosite := - Def.sequential(microsite, makeDocs, makeSite).value, + Def.sequential(microsite, makeMdoc, makeSite).value, makeVersionsJson := { "which git".! match { case 0 => () @@ -478,7 +447,7 @@ trait MicrositeAutoImportSettings extends MicrositeKeys { } }, makeVersionedMicrosite := - Def.sequential(microsite, makeVersionsJson, makeDocs, makeSite).value, + Def.sequential(microsite, makeVersionsJson, makeMdoc, makeSite).value, makeMultiversionMicrosite := Def .sequential(createMicrositeVersions, clean, makeVersionedMicrosite, moveMicrositeVersions) diff --git a/src/main/scala/microsites/MicrositesPlugin.scala b/src/main/scala/microsites/MicrositesPlugin.scala index 9dc0de8c..9b4f8e2d 100644 --- a/src/main/scala/microsites/MicrositesPlugin.scala +++ b/src/main/scala/microsites/MicrositesPlugin.scala @@ -23,8 +23,6 @@ import com.typesafe.sbt.site.SitePlugin.autoImport._ import sbt.Keys._ import sbt._ import sbt.plugins.IvyPlugin -import tut.TutPlugin -import tut.TutPlugin.autoImport._ import mdoc.MdocPlugin import mdoc.MdocPlugin.autoImport._ @@ -38,7 +36,7 @@ object MicrositesPlugin extends AutoPlugin { import com.typesafe.sbt.site.jekyll.JekyllPlugin.autoImport._ override def requires: Plugins = - IvyPlugin && MdocPlugin && TutPlugin && JekyllPlugin && GhpagesPlugin + IvyPlugin && MdocPlugin && JekyllPlugin && GhpagesPlugin override def trigger: PluginTrigger = allRequirements @@ -48,8 +46,6 @@ object MicrositesPlugin extends AutoPlugin { Seq( git.remoteRepo := s"git@github.com:${micrositeGithubOwner.value}/${micrositeGithubRepo.value}.git", sourceDirectory in Jekyll := resourceManaged.value / "main" / "jekyll", - tutSourceDirectory := sourceDirectory.value / "main" / "tut", - tutTargetDirectory := resourceManaged.value / "main" / "jekyll", mdocIn := baseDirectory.value / "docs", mdocOut := resourceManaged.value / "main" / "jekyll" ) @@ -126,7 +122,6 @@ object MicrositesPlugin extends AutoPlugin { micrositeFooterText := Some(layouts.Layout.footer.toString), micrositeEditButton := None, micrositeGithubLinks := true, - micrositeCompilingDocsTool := WithMdoc, includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.jpeg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.webm" | "*.ico" | "CNAME" | "*.yml" | "*.svg" | "*.json", includeFilter in Jekyll := (includeFilter in makeSite).value || "LICENSE", commands ++= Seq(publishMicrositeCommand), diff --git a/src/sbt-test/microsites/change-default-paths/build.sbt b/src/sbt-test/microsites/change-default-paths/build.sbt index f4406e7c..05ff2f75 100644 --- a/src/sbt-test/microsites/change-default-paths/build.sbt +++ b/src/sbt-test/microsites/change-default-paths/build.sbt @@ -15,4 +15,4 @@ micrositeExtraMdFilesOutput := (target in Compile).value / "extra_md_override" micrositeImgDirectory := (resourceDirectory in Compile).value / "images" micrositeCssDirectory := (resourceDirectory in Compile).value / "styles" micrositePluginsDirectory := (resourceDirectory in Compile).value / "plugins" -mdocIn := baseDirectory.in(ThisBuild).value / "src" / "main" / "tut" \ No newline at end of file +mdocIn := baseDirectory.in(ThisBuild).value / "src" / "main" / "mdoc" \ No newline at end of file diff --git a/src/sbt-test/microsites/extra-md-files/build.sbt b/src/sbt-test/microsites/extra-md-files/build.sbt index 46c6972c..b71a5bea 100644 --- a/src/sbt-test/microsites/extra-md-files/build.sbt +++ b/src/sbt-test/microsites/extra-md-files/build.sbt @@ -3,7 +3,6 @@ import microsites._ enablePlugins(MicrositesPlugin) scalaVersion := sys.props("scala.version") -micrositeCompilingDocsTool := WithTut micrositeExtraMdFiles := Map( file("README.md") -> ExtraMdFileConfig( "readme.md", diff --git a/src/sbt-test/microsites/tut-compile/README.md b/src/sbt-test/microsites/tut-compile/README.md deleted file mode 100644 index 066b4103..00000000 --- a/src/sbt-test/microsites/tut-compile/README.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: home ---- - -# Header 1 - -Quisque sed lorem eu neque sollicitudin scelerisque ut id nisl. - -Nunc et nunc vel tortor eleifend rutrum ut hendrerit ipsum. - -> Suspendisse et blandit magna. - -```tut -val list = List(1, 2, 3) -list map (_ * 2) -``` - -Suspendisse sed faucibus ex. Aliquam at ultrices lacus, sit amet tempus augue. Fusce facilisis tincidunt tortor, nec ultrices tortor egestas sed. - -## Header 2 - -Vivamus in nisi laoreet, mattis erat eget, ornare ligula. Aliquam rhoncus lorem ac hendrerit sagittis. In hac habitasse platea dictumst. - -Maecenas ut facilisis eros. Proin nisl urna, pharetra ut semper convallis, consequat aliquam turpis. Nam a magna varius, egestas nisl nec, pharetra sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent libero magna, ornare nec odio id, cursus porta ante. Maecenas volutpat, neque eget bibendum faucibus, sapien nisi tincidunt eros, eu scelerisque lorem ante vel justo. Nullam euismod dolor sed lacus dapibus, dictum egestas dolor accumsan. \ No newline at end of file diff --git a/src/sbt-test/microsites/tut-compile/build.sbt b/src/sbt-test/microsites/tut-compile/build.sbt deleted file mode 100644 index 16c13323..00000000 --- a/src/sbt-test/microsites/tut-compile/build.sbt +++ /dev/null @@ -1,13 +0,0 @@ -import microsites._ - -enablePlugins(MicrositesPlugin) -scalaVersion := sys.props("scala.version") - -micrositeCompilingDocsTool := WithTut - -micrositeExtraMdFiles := Map( - file("README.md") -> ExtraMdFileConfig( - "index.md", - "home" - ) -) diff --git a/src/sbt-test/microsites/tut-compile/project/plugins.sbt b/src/sbt-test/microsites/tut-compile/project/plugins.sbt deleted file mode 100644 index 82228d9f..00000000 --- a/src/sbt-test/microsites/tut-compile/project/plugins.sbt +++ /dev/null @@ -1,2 +0,0 @@ -resolvers += Resolver.sonatypeRepo("snapshots") -addSbtPlugin("com.47deg" % "sbt-microsites" % sys.props("plugin.version")) diff --git a/src/sbt-test/microsites/tut-compile/src/main/tut/docs.md b/src/sbt-test/microsites/tut-compile/src/main/tut/docs.md deleted file mode 100644 index 1051a8e1..00000000 --- a/src/sbt-test/microsites/tut-compile/src/main/tut/docs.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: docs ---- - -# Header 1 - -Quisque sed lorem eu neque sollicitudin scelerisque ut id nisl. - -Nunc et nunc vel tortor eleifend rutrum ut hendrerit ipsum. - -> Suspendisse et blandit magna. - -```tut -val list = List(1, 2, 3) -list map (_ * 2) -``` - -Suspendisse sed faucibus ex. Aliquam at ultrices lacus, sit amet tempus augue. Fusce facilisis tincidunt tortor, nec ultrices tortor egestas sed. - -## Header 2 - -Vivamus in nisi laoreet, mattis erat eget, ornare ligula. Aliquam rhoncus lorem ac hendrerit sagittis. In hac habitasse platea dictumst. - -Maecenas ut facilisis eros. Proin nisl urna, pharetra ut semper convallis, consequat aliquam turpis. Nam a magna varius, egestas nisl nec, pharetra sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent libero magna, ornare nec odio id, cursus porta ante. Maecenas volutpat, neque eget bibendum faucibus, sapien nisi tincidunt eros, eu scelerisque lorem ante vel justo. Nullam euismod dolor sed lacus dapibus, dictum egestas dolor accumsan. \ No newline at end of file diff --git a/src/sbt-test/microsites/tut-compile/test b/src/sbt-test/microsites/tut-compile/test deleted file mode 100644 index 8aa8d406..00000000 --- a/src/sbt-test/microsites/tut-compile/test +++ /dev/null @@ -1,14 +0,0 @@ -# check that the sbt-microsites plugin work fine when tut compiles a markdown file - -> makeMicrosite - -# check markdown resource_managed/main/jekyll folder - -$ exists target/scala-2.12/resource_managed/main/jekyll/index.md -$ exists target/scala-2.12/resource_managed/main/jekyll/docs.md - -# check site folder - -$ exists target/scala-2.12/resource_managed/main/jekyll/_config.yml -$ exists target/site/index.html -$ exists target/site/docs.html From 743aabda5af2b4fd50b95d946eec7232c1326451 Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Wed, 23 Dec 2020 18:27:07 +0100 Subject: [PATCH 2/4] Updates docs --- microsite/docs/docs/build-the-microsite.md | 2 +- microsite/docs/docs/getting-started.md | 5 +---- microsite/docs/docs/intro.md | 1 - microsite/docs/docs/layouts.md | 2 +- microsite/docs/docs/settings.md | 13 +++---------- microsite/docs/docs/typechecked-snippets.md | 19 ++----------------- .../src/main/{tut => mdoc}/docs.md | 0 .../microsites/extra-md-files/docs/README.md | 3 +++ .../microsites-tasks/docs/README.md | 3 +++ 9 files changed, 14 insertions(+), 34 deletions(-) rename src/sbt-test/microsites/change-default-paths/src/main/{tut => mdoc}/docs.md (100%) create mode 100644 src/sbt-test/microsites/extra-md-files/docs/README.md create mode 100644 src/sbt-test/microsites/microsites-tasks/docs/README.md diff --git a/microsite/docs/docs/build-the-microsite.md b/microsite/docs/docs/build-the-microsite.md index 014f618b..fcbc6b66 100644 --- a/microsite/docs/docs/build-the-microsite.md +++ b/microsite/docs/docs/build-the-microsite.md @@ -12,7 +12,7 @@ Once you have written your documents, you can build the microsite running this s sbt> makeMicrosite ``` -Internally, it'll sequentially run other tasks including its own, [`tut`](https://github.com/tpolecat/tut) or [`mdoc`](https://scalameta.org/mdoc/), and `makeSite` ([sbt-site](https://github.com/sbt/sbt-site)) tasks. +Internally, it'll sequentially run other tasks including its own, [`mdoc`](https://scalameta.org/mdoc/), and `makeSite` ([sbt-site](https://github.com/sbt/sbt-site)) tasks. # Multiversion support diff --git a/microsite/docs/docs/getting-started.md b/microsite/docs/docs/getting-started.md index 61defe9e..13258c74 100644 --- a/microsite/docs/docs/getting-started.md +++ b/microsite/docs/docs/getting-started.md @@ -57,7 +57,4 @@ enablePlugins(MicrositesPlugin) # Write your documentation `.md` files -Your docs can be placed wherever you want in your project since there are sbt settings to point to the sources of your microsite, however the plugin expects to find the sources where both [**tut**](https://github.com/tpolecat/tut) and [**mdoc**](https://github.com/scalameta/mdoc) have defined by default. They are: - -- Tut: `src/main/tut/` -- mdoc: `docs/` \ No newline at end of file +Your docs can be placed wherever you want in your project since there are sbt settings to point to the sources of your microsite, however the plugin expects to find the sources where [**mdoc**](https://github.com/scalameta/mdoc) have defined by default (`docs/`). \ No newline at end of file diff --git a/microsite/docs/docs/intro.md b/microsite/docs/docs/intro.md index f0879bc7..bb1a315b 100644 --- a/microsite/docs/docs/intro.md +++ b/microsite/docs/docs/intro.md @@ -25,7 +25,6 @@ The plugin provides basic free styles, css, and image resources by default. Ever In order to create microsites, this plugin directly uses the following plugins and libraries: -* [tut-plugin](https://github.com/tpolecat/tut) * [sbt-mdoc](https://github.com/scalameta/mdoc) * [sbt-site](https://github.com/sbt/sbt-site) * [sbt-ghpages](https://github.com/sbt/sbt-ghpages) diff --git a/microsite/docs/docs/layouts.md b/microsite/docs/docs/layouts.md index d1332580..9f0aa2c3 100644 --- a/microsite/docs/docs/layouts.md +++ b/microsite/docs/docs/layouts.md @@ -67,7 +67,7 @@ To be able to access the documentation, you have to configure `micrositeDocument In order to change the default label description for the `micrositeDocumentationUrl` (the default value is `Documentation`), you have to change the `micrositeDocumentationLabelDescription`. -As an example, you can look at the sbt-microsites documentation at [GitHub](https://github.com/47deg/sbt-microsites/tree/master/docs/src/main/tut). We have several documentation files: +As an example, you can look at the sbt-microsites documentation at [GitHub](https://github.com/47degrees/sbt-microsites/tree/master/microsite/docs). We have several documentation files: - `build-the-microsite.md` - `customize.md` diff --git a/microsite/docs/docs/settings.md b/microsite/docs/docs/settings.md index 4e75de93..75e7ba64 100644 --- a/microsite/docs/docs/settings.md +++ b/microsite/docs/docs/settings.md @@ -260,7 +260,7 @@ micrositeStaticDirectory := (resourceDirectory in Compile).value / "site" / "mys The directory will be copied as-is, but no process will be applied to any file on it. So the responsibility of loading/linking/using them on a layout is yours. Also, see the `includeFilter in makeSite` config setting for the allowed file types that will be copied. -- `micrositeExtraMdFiles`: This setting can be handy if you want to include additional markdown files in your site, and these files are not located in the same place in your `mdoc` or `tut` directory. By default, the setting is set up as an empty map. You can override it in this way: +- `micrositeExtraMdFiles`: This setting can be handy if you want to include additional markdown files in your site, and these files are not located in the same place in your `mdoc` directory. By default, the setting is set up as an empty map. You can override it in this way: ```scala micrositeExtraMdFiles := Map( @@ -278,7 +278,7 @@ micrositeExtraMdFiles := Map( Each file (the map key) can be related to a specific configuration through the `ExtraMdFileConfig` case class. This class allows you to specify three additional configurations: -1. The target file name. The plugin will copy the file, and it will put it in tut directory each time you build the microsite. Therefore, you might want to include this auto-copied file in the list of ignored files at the `.gitignore` file. +1. The target file name. The plugin will copy the file, and it will put it in mdoc directory each time you build the microsite. Therefore, you might want to include this auto-copied file in the list of ignored files at the `.gitignore` file. 2. Jekyll `layout` property. 3. Other custom Jekyll properties that you might want to include in your document. A good point to highlight here is that through the `permalink` property you can control the place where `Jekyll` is going to move your extra file. The value of this property prevails over the folder where the file is copied. @@ -367,16 +367,9 @@ repository URL, and should include the dynamic property `{% raw %}{{page.path}}{ compiles the site. **The strings are passed in unsanitized to the templating engine.** ```scala -{% raw %}micrositeEditButton := Some(MicrositeEditButton("Improve this Page", "/edit/master/docs/src/main/tut/{{ page.path }}")){% endraw %} +{% raw %}micrositeEditButton := Some(MicrositeEditButton("Improve this Page", "/edit/master/docs/{{ page.path }}")){% endraw %} ``` -- `micrositeCompilingDocsTool`: Choose between compiling code snippets with [**tut**](https://github.com/tpolecat/tut) or [**mdoc**](https://github.com/scalameta/mdoc). By default, it's set to `WithMdoc` since the sbt-microsites 1.0.0 release. But you could use `WithTut` if you want to preserve the compatibility with previous versions of your markdown files. - -```scala -micrositeCompilingDocsTool := WithMdoc -``` -If you are interested in learning where to place the markdown files according to the compilation tool chosen, please take a look at the [Typechecked Snippets]({% link docs/typechecked-snippets.md %}) section. - - `includeFilter in makeSite`: Restrict the type of files that are included during the microsite build. The default value is `"*.html" | "*.css" | "*.png" | "*.jpg" | "*.jpeg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.webm" | "*.ico" | "CNAME" | "*.yml" | "*.svg" | "*.json"` but you can override it like this: ```scala diff --git a/microsite/docs/docs/typechecked-snippets.md b/microsite/docs/docs/typechecked-snippets.md index c5c825c1..2d213c83 100644 --- a/microsite/docs/docs/typechecked-snippets.md +++ b/microsite/docs/docs/typechecked-snippets.md @@ -6,33 +6,18 @@ permalink: docs/typechecked-snippets/ # Typechecked Snippets -As has been mentioned a couple of times throughout this tutorial, this plugin supports the compilation of Scala code written in markdown files. This process is now being delegated on two different sbt plugins: [**tut**](https://github.com/tpolecat/tut) and [**mdoc**](https://github.com/scalameta/mdoc). - -## Tut - -[tut](https://github.com/tpolecat/tut) has been deprecated, please switch to mdoc (see next section). If for some reason you want to keep using it, here there are some recommendations: - -- Set this property accordingly: `micrositeCompilingDocsTool := WithTut`. -- Add your markdown files in this path by default: `src/main/tut/`. -- If you want to place your documments in a different path, just set the sbt property `tutSourceDirectory := your-path` being _your-path_ a `SettingKey[File]`. -- Mark the snippets that you want to compile, following this convention: **_```tut_** or any of its [modifiers](https://tpolecat.github.io/tut/modifiers.html) - +As has been mentioned a couple of times throughout this tutorial, this plugin supports the compilation of Scala code written in markdown files. This process is now being delegated on [**mdoc**](https://github.com/scalameta/mdoc). ## mdoc `mdoc` is the option by default, so no special action is required from your side. See the scalameta site for more information [here](https://scalameta.org/mdoc/). Here is some advice for using this in your microsite: - Add your markdown files in this path by default: `docs/`. -- By default, the setting `micrositeCompilingDocsTool` will be `WithMdoc`, so no action would be required. - If you want to place your documents in a different path, just set the sbt property `mdocIn := your-path` being _your-path_ a `SettingKey[File]`. - Mark the snippets that you want to compile, following this convention: **_```scala mdoc_** or any of its [modifiers](https://scalameta.org/mdoc/docs/modifiers.html) ## Migrating from tut to mdoc -You can migrate your microsite from _tut_ to _mdoc_ in 3 smooth steps: - -- Set this property accordingly: `micrositeCompilingDocsTool := WithMdoc` -- Set the property `mdocIn := tutSourceDirectory`, thus we are setting the source for mdoc as it used to be for tut. -- Replace **_tut_** with **_mdoc_** in the snippets modifiers following this [migration guide](https://scalameta.org/mdoc/docs/tut.html). +If your project is still based on `tut`, you can migrate it from _tut_ to _mdoc_ can follow this [migration guide](https://scalameta.org/mdoc/docs/tut.html). There is also a [script](https://github.com/scalameta/mdoc/blob/5c732bc48eb88b8a416e5c61e945eac6d410b27b/bin/migrate-tut.sh) that does the replacement for you. diff --git a/src/sbt-test/microsites/change-default-paths/src/main/tut/docs.md b/src/sbt-test/microsites/change-default-paths/src/main/mdoc/docs.md similarity index 100% rename from src/sbt-test/microsites/change-default-paths/src/main/tut/docs.md rename to src/sbt-test/microsites/change-default-paths/src/main/mdoc/docs.md diff --git a/src/sbt-test/microsites/extra-md-files/docs/README.md b/src/sbt-test/microsites/extra-md-files/docs/README.md new file mode 100644 index 00000000..fa3d3928 --- /dev/null +++ b/src/sbt-test/microsites/extra-md-files/docs/README.md @@ -0,0 +1,3 @@ +# Overview + +README file of the project, located in the project's root. diff --git a/src/sbt-test/microsites/microsites-tasks/docs/README.md b/src/sbt-test/microsites/microsites-tasks/docs/README.md new file mode 100644 index 00000000..fa3d3928 --- /dev/null +++ b/src/sbt-test/microsites/microsites-tasks/docs/README.md @@ -0,0 +1,3 @@ +# Overview + +README file of the project, located in the project's root. From 3f28e15d404dcc34baef78863d44abf7bdacf31d Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Wed, 23 Dec 2020 18:27:20 +0100 Subject: [PATCH 3/4] Fixes scripted tests --- src/sbt-test/microsites/extra-md-files/README.md | 3 --- src/sbt-test/microsites/extra-md-files/build.sbt | 4 ++-- .../microsites/extra-md-files/{ => docs}/CONSEQUAT.md | 4 ++++ src/sbt-test/microsites/extra-md-files/docs/README.md | 4 ++++ src/sbt-test/microsites/mdoc-compile/build.sbt | 1 - src/sbt-test/microsites/mdoc-extra-md-files/build.sbt | 1 - src/sbt-test/microsites/microsites-tasks/docs/README.md | 4 ++++ src/sbt-test/microsites/microsites-tasks/test | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) delete mode 100644 src/sbt-test/microsites/extra-md-files/README.md rename src/sbt-test/microsites/extra-md-files/{ => docs}/CONSEQUAT.md (79%) diff --git a/src/sbt-test/microsites/extra-md-files/README.md b/src/sbt-test/microsites/extra-md-files/README.md deleted file mode 100644 index fa3d3928..00000000 --- a/src/sbt-test/microsites/extra-md-files/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Overview - -README file of the project, located in the project's root. diff --git a/src/sbt-test/microsites/extra-md-files/build.sbt b/src/sbt-test/microsites/extra-md-files/build.sbt index b71a5bea..04800519 100644 --- a/src/sbt-test/microsites/extra-md-files/build.sbt +++ b/src/sbt-test/microsites/extra-md-files/build.sbt @@ -4,11 +4,11 @@ enablePlugins(MicrositesPlugin) scalaVersion := sys.props("scala.version") micrositeExtraMdFiles := Map( - file("README.md") -> ExtraMdFileConfig( + file("docs/README.md") -> ExtraMdFileConfig( "readme.md", "home" ), - file("CONSEQUAT.md") -> ExtraMdFileConfig( + file("docs/CONSEQUAT.md") -> ExtraMdFileConfig( "consequat.md", "page", Map("title" -> "Consequata", "section" -> "consequata", "position" -> "1") diff --git a/src/sbt-test/microsites/extra-md-files/CONSEQUAT.md b/src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md similarity index 79% rename from src/sbt-test/microsites/extra-md-files/CONSEQUAT.md rename to src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md index 99eb293d..7e0d357f 100644 --- a/src/sbt-test/microsites/extra-md-files/CONSEQUAT.md +++ b/src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md @@ -1,3 +1,7 @@ +--- +layout: page +--- + # Consequat Overview Consequat is another random file, located in the project's root. diff --git a/src/sbt-test/microsites/extra-md-files/docs/README.md b/src/sbt-test/microsites/extra-md-files/docs/README.md index fa3d3928..05fcc024 100644 --- a/src/sbt-test/microsites/extra-md-files/docs/README.md +++ b/src/sbt-test/microsites/extra-md-files/docs/README.md @@ -1,3 +1,7 @@ +--- +layout: home +------------ + # Overview README file of the project, located in the project's root. diff --git a/src/sbt-test/microsites/mdoc-compile/build.sbt b/src/sbt-test/microsites/mdoc-compile/build.sbt index 14c83886..cd367d48 100644 --- a/src/sbt-test/microsites/mdoc-compile/build.sbt +++ b/src/sbt-test/microsites/mdoc-compile/build.sbt @@ -1,3 +1,2 @@ enablePlugins(MicrositesPlugin) scalaVersion := sys.props("scala.version") -micrositeCompilingDocsTool := WithMdoc diff --git a/src/sbt-test/microsites/mdoc-extra-md-files/build.sbt b/src/sbt-test/microsites/mdoc-extra-md-files/build.sbt index b04f20fe..b04d00dd 100644 --- a/src/sbt-test/microsites/mdoc-extra-md-files/build.sbt +++ b/src/sbt-test/microsites/mdoc-extra-md-files/build.sbt @@ -1,7 +1,6 @@ import microsites.ExtraMdFileConfig enablePlugins(MicrositesPlugin) scalaVersion := sys.props("scala.version") -micrositeCompilingDocsTool := WithMdoc micrositeExtraMdFilesOutput := (resourceManaged in Compile).value / "jekyll" diff --git a/src/sbt-test/microsites/microsites-tasks/docs/README.md b/src/sbt-test/microsites/microsites-tasks/docs/README.md index fa3d3928..15f28bdf 100644 --- a/src/sbt-test/microsites/microsites-tasks/docs/README.md +++ b/src/sbt-test/microsites/microsites-tasks/docs/README.md @@ -1,3 +1,7 @@ +--- +layout: docs +--- + # Overview README file of the project, located in the project's root. diff --git a/src/sbt-test/microsites/microsites-tasks/test b/src/sbt-test/microsites/microsites-tasks/test index 122372f7..84cb1bdc 100644 --- a/src/sbt-test/microsites/microsites-tasks/test +++ b/src/sbt-test/microsites/microsites-tasks/test @@ -2,7 +2,7 @@ > microsite -> tut +> mdoc > makeSite From 6ae4c0a6a7bc46d9e38b05484af37e3d5543c3ed Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Wed, 23 Dec 2020 19:05:25 +0100 Subject: [PATCH 4/4] Removes useless test --- .../microsites/extra-md-files/build.sbt | 39 ------------------- .../extra-md-files/docs/CONSEQUAT.md | 7 ---- .../microsites/extra-md-files/docs/README.md | 7 ---- .../extra-md-files/project/plugins.sbt | 2 - src/sbt-test/microsites/extra-md-files/test | 13 ------- 5 files changed, 68 deletions(-) delete mode 100644 src/sbt-test/microsites/extra-md-files/build.sbt delete mode 100644 src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md delete mode 100644 src/sbt-test/microsites/extra-md-files/docs/README.md delete mode 100644 src/sbt-test/microsites/extra-md-files/project/plugins.sbt delete mode 100644 src/sbt-test/microsites/extra-md-files/test diff --git a/src/sbt-test/microsites/extra-md-files/build.sbt b/src/sbt-test/microsites/extra-md-files/build.sbt deleted file mode 100644 index 04800519..00000000 --- a/src/sbt-test/microsites/extra-md-files/build.sbt +++ /dev/null @@ -1,39 +0,0 @@ -import microsites._ - -enablePlugins(MicrositesPlugin) -scalaVersion := sys.props("scala.version") - -micrositeExtraMdFiles := Map( - file("docs/README.md") -> ExtraMdFileConfig( - "readme.md", - "home" - ), - file("docs/CONSEQUAT.md") -> ExtraMdFileConfig( - "consequat.md", - "page", - Map("title" -> "Consequata", "section" -> "consequata", "position" -> "1") - ) -) - -def getLines(fileName: String) = - IO.readLines(file(fileName)) - -lazy val checkReadme = TaskKey[Unit]("checkReadme") - -checkReadme := { - val lines = - getLines("target/scala-2.12/resource_managed/main/jekyll/readme.md") - - if (!lines(1).contains("home")) - sys.error("Readme file has not layout home") -} - -lazy val checkConsequat = TaskKey[Unit]("checkConsequat") - -checkConsequat := { - val lines = - getLines("target/scala-2.12/resource_managed/main/jekyll/consequat.md") - - if (!lines(1).contains("page")) - sys.error("Consequat file has not layout page") -} diff --git a/src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md b/src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md deleted file mode 100644 index 7e0d357f..00000000 --- a/src/sbt-test/microsites/extra-md-files/docs/CONSEQUAT.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: page ---- - -# Consequat Overview - -Consequat is another random file, located in the project's root. diff --git a/src/sbt-test/microsites/extra-md-files/docs/README.md b/src/sbt-test/microsites/extra-md-files/docs/README.md deleted file mode 100644 index 05fcc024..00000000 --- a/src/sbt-test/microsites/extra-md-files/docs/README.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -layout: home ------------- - -# Overview - -README file of the project, located in the project's root. diff --git a/src/sbt-test/microsites/extra-md-files/project/plugins.sbt b/src/sbt-test/microsites/extra-md-files/project/plugins.sbt deleted file mode 100644 index 82228d9f..00000000 --- a/src/sbt-test/microsites/extra-md-files/project/plugins.sbt +++ /dev/null @@ -1,2 +0,0 @@ -resolvers += Resolver.sonatypeRepo("snapshots") -addSbtPlugin("com.47deg" % "sbt-microsites" % sys.props("plugin.version")) diff --git a/src/sbt-test/microsites/extra-md-files/test b/src/sbt-test/microsites/extra-md-files/test deleted file mode 100644 index 0c5bce9c..00000000 --- a/src/sbt-test/microsites/extra-md-files/test +++ /dev/null @@ -1,13 +0,0 @@ -# check that the sbt-microsites plugin works for external files outside tut directory - -> makeMicrosite - -$ exists target/scala-2.12/resource_managed/main/jekyll - -# check readme.md file - -> checkReadme - -# check consequat.md file - -> checkConsequat \ No newline at end of file