aboutsummaryrefslogtreecommitdiff
path: root/dokka-runners/dokkatoo/modules/docs/build.gradle.kts
blob: a27b177c14baa9ad155e6923d53dc3e886529936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import dev.adamko.dokkatoo.dokka.plugins.DokkaHtmlPluginParameters

plugins {
  buildsrc.conventions.base
  dev.adamko.`dokkatoo-html`
}

dependencies {
  dokkatoo(projects.modules.dokkatooPlugin)
  dokkatooPluginHtml(libs.kotlin.dokkaPlugin.allModulesPage)
  dokkatooPluginHtml(libs.kotlin.dokkaPlugin.templating)
}

dokkatoo {
  moduleName.set("Dokkatoo Gradle Plugin")

  pluginsConfiguration.named<DokkaHtmlPluginParameters>("html") {
    customStyleSheets.from(
      "./style/logo-styles.css",
    )
    customAssets.from(
      "./images/logo-icon.svg",
    )
  }
}

tasks.dokkatooGeneratePublicationHtml {
  doLast {
    outputDirectory.get().asFile.walk()
      .filter { it.isFile && it.extension == "html" }
      .forEach { file ->
        file.writeText(
          file.readText()
            .replace(
              """<html>""",
              """<html lang="en">""",
            )
            .replace(
              """
                <button id="theme-toggle-button">
              """.trimIndent(),
              """
                <div id="github-link"><a href="https://github.com/adamko-dev/dokkatoo/"></a></div>
                <button id="theme-toggle-button">
              """.trimIndent(),
            )
            .replace(
              """
                href="https://github.com/Kotlin/dokka"><span>dokka</span>
              """.trimIndent(),
              """
                href="https://github.com/adamko-dev/dokkatoo/"><span>Dokkatoo</span>
              """.trimIndent(),
            )
        )
      }
  }
}