From d8687d653fe521451642a006987cff7c021fda3d Mon Sep 17 00:00:00 2001
From: Brian Groenke <brian.groenke@awi.de>
Date: Mon, 9 Dec 2024 17:21:01 +0100
Subject: [PATCH] Fix out of date doc build

---
 docs/Project.toml               |  1 +
 docs/make.jl                    | 20 ++++++++++++++++----
 docs/src/api/presets.md         |  7 -------
 docs/src/manual/architecture.md |  1 -
 4 files changed, 17 insertions(+), 12 deletions(-)
 delete mode 100644 docs/src/api/presets.md

diff --git a/docs/Project.toml b/docs/Project.toml
index fd07404a..8ea8a724 100644
--- a/docs/Project.toml
+++ b/docs/Project.toml
@@ -1,4 +1,5 @@
 [deps]
+ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
 CryoGrid = "a535b82e-5f3d-4d97-8b0b-d6483f5bebd5"
 Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
 Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
diff --git a/docs/make.jl b/docs/make.jl
index 722f4fe9..391355a0 100644
--- a/docs/make.jl
+++ b/docs/make.jl
@@ -1,10 +1,21 @@
+using ArgParse
 using CryoGrid
 using Documenter
 using Literate
 
-# ENV["LOCALDOCS"] = "true"
+s = ArgParseSettings()
+@add_arg_table! s begin
+    "--local", "-l"
+       action = :store_true
+       help = "Local docs build mode"
+    "--draft", "-d"
+       action = :store_true
+       help = "Whether to build docs in draft mode, i.e. skipping execution of examples and doctests"
+end
+parsed_args = parse_args(ARGS, s)
 
-IS_LOCAL = haskey(ENV,"LOCALDOCS") && ENV["LOCALDOCS"] == "true"
+IS_LOCAL = parsed_args["local"] || parse(Bool, get(ENV, "LOCALDOCS", "false"))
+IS_DRAFT = parsed_args["draft"] || parse(Bool, get(ENV, "DRAFTDOCS", "false"))
 if haskey(ENV, "GITHUB_ACTIONS")
        ENV["JULIA_DEBUG"] = "Documenter"
 end
@@ -22,7 +33,6 @@ const modules = [
        CryoGrid.Soils,
        CryoGrid.Snow,
        CryoGrid.Surface,
-       CryoGrid.Presets,
        CryoGrid.Diagnostics,
        # solvers
        CryoGrid.DiffEq,
@@ -65,6 +75,7 @@ example_docpages = map(example_docfiles) do f
 end
 
 makedocs(
+       repo=Remotes.GitHub("CryoGrid", "CryoGrid.jl"),
        modules=modules,
        sitename="CryoGrid.jl",
        authors="Brian Groenke, Moritz Langer, Jan Nitzbon",
@@ -73,6 +84,8 @@ makedocs(
               canonical = "https://cryogrid.github.io/CryoGrid.jl/v0",
        ),
        warnonly=true, # don't fail when there are errors
+       doctest=!IS_DRAFT,
+       draft=IS_DRAFT,
        pages=["Home" => "index.md",
               "Installation" => "installation.md",
               "Getting Started" => "quickstart.md",
@@ -107,7 +120,6 @@ makedocs(
                      "CryoGridLite" => "api/solvers/lite_implicit.md",
               ],
               "Diagnostics" => "api/diagnostics.md",
-              "Presets" => "api/presets.md",
        ],
 ])
 
diff --git a/docs/src/api/presets.md b/docs/src/api/presets.md
deleted file mode 100644
index b78f64d2..00000000
--- a/docs/src/api/presets.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Presets (@)
-
-```@autodocs
-Modules = [CryoGrid.Presets]
-Private = false
-Order = [:type, :function, :macro]
-```
\ No newline at end of file
diff --git a/docs/src/manual/architecture.md b/docs/src/manual/architecture.md
index 5cadab06..cf54aeca 100644
--- a/docs/src/manual/architecture.md
+++ b/docs/src/manual/architecture.md
@@ -27,7 +27,6 @@ The `CryoGrid` module provided by CryoGrid.jl is organized into a series of subm
 |`Tiles`|Defines the `Tile` and `Stratigraphy` types for constructing 1D land models.|`Utils`,`Numerics`,`InputOutput`|
 |`DiffEq`|Provides dispatches and utilities for integrating with solvers from the SciML `OrdinaryDiffEq` package.|`Utils`,`Numerics`,`InputOutput`|
 |`LiteImplicit`|Provides an implementation of the `CryoGridLite` solver scheme from Langer et al. 2023.|`Utils`,`Numerics`|
-|`Presets`|Provides pre-defined stratigraphies, forcings, and layer configurations to facilitate rapid prototyping.|`Utils`,`Numerics`,`InputOutput`,`Heat`,`Hydrology`,`Soils`|
 
 Note that all submodules depend on the top-level `CryoGrid` module which declares all of the "core" types and [method interfaces](https://docs.julialang.org/en/v1/manual/interfaces/) for defining model behavior. Each submodule may additionally define its own method interfaces related to its own specific process(es) or layer(s).
 
-- 
GitLab