Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: disable edit links for previous versions #3861

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions docs/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jsoup._
import mill.util.Jvm
import mill._, scalalib._
import de.tobiasroeser.mill.vcs.version.VcsVersion
import collection.JavaConverters._
import scala.jdk.CollectionConverters._

/** Generates the mill documentation with Antora. */
object `package` extends RootModule {
Expand Down Expand Up @@ -192,6 +192,7 @@ object `package` extends RootModule {
val taggedSources = for (path <- extraSources) yield {
s""" - url: ${build.baseDir}
| start_path: ${path.relativeTo(build.baseDir)}
| edit_url: false
|""".stripMargin
}
s"""site:
Expand All @@ -206,6 +207,7 @@ object `package` extends RootModule {
| - url: ${if (authorMode) build.baseDir else build.Settings.projectUrl}
| branches: []
| tags: ${build.Settings.legacyDocTags.filter(_ => !authorMode).map("'" + _ + "'").mkString("[", ",", "]")}
| edit_url: false
| start_path: docs/antora
|
|${taggedSources.mkString("\n\n")}
Expand Down Expand Up @@ -237,7 +239,7 @@ object `package` extends RootModule {
|""".stripMargin
}

def oldDocSources = Task {
def oldDocSources: T[Seq[PathRef]] = Task {
for (oldVersion <- build.Settings.docTags) yield {
val checkout = T.dest / oldVersion
os.proc("git", "clone", T.workspace / ".git", checkout).call(stdout = os.Inherit)
Expand All @@ -254,21 +256,22 @@ object `package` extends RootModule {
generatePages(authorMode = false)().apply(oldDocSources().map(_.path))
}

def localPages = Task {
def localPages: T[PathRef] = Task {
val pages = generatePages(authorMode = true)().apply(oldDocSources().map(_.path))
T.log.outputStream.println(
s"You can browse the local pages at: ${(pages.path / "index.html").toNIO.toUri()}"
s"You can browse the pages at: ${(pages.path / "index.html").toNIO.toUri()}"
)
pages
}
def fastPages = Task {
def fastPages: T[PathRef] = Task {
val pages = generatePages(authorMode = true)().apply(Nil)
T.log.outputStream.println(
s"You can browse the local pages at: ${(pages.path / "index.html").toNIO.toUri()}"
s"You can browse the pages at: ${(pages.path / "index.html").toNIO.toUri()}"
)
pages
}

def generatePages(authorMode: Boolean) = T.task { extraSources: Seq[os.Path] =>
def generatePages(authorMode: Boolean) = Task.Anon { extraSources: Seq[os.Path] =>
T.log.errorStream.println("Creating Antora playbook ...")
// dependency to sources
source()
Expand Down
Loading