From 566bf8ccc015b3f6aef40acf8e00106bdc6ff9f3 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Thu, 30 May 2024 08:38:31 -0700 Subject: [PATCH] Add tutorial --- docs/Manifest.toml | 8 +++++++- docs/Project.toml | 1 + docs/make.jl | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/Manifest.toml b/docs/Manifest.toml index a2ff6ff02..1d26de0b8 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.3" manifest_format = "2.0" -project_hash = "549a944f3e0b1062b2c4a8fabcca43ca4022be0d" +project_hash = "a503b4f951cf10fc76e1520a620cb8fdc7c63464" [[deps.ADTypes]] git-tree-sha1 = "daf26bbdec60d9ca1c0003b70f389d821ddb4224" @@ -1102,6 +1102,12 @@ version = "2.8.0" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" +[[deps.Literate]] +deps = ["Base64", "IOCapture", "JSON", "REPL"] +git-tree-sha1 = "596df2daea9c27da81eee63ef2cf101baf10c24c" +uuid = "98b081ad-f1c9-55d3-8b20-4c87d4299306" +version = "2.18.0" + [[deps.LogExpFunctions]] deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] git-tree-sha1 = "18144f3e9cbe9b15b070288eef858f71b291ce37" diff --git a/docs/Project.toml b/docs/Project.toml index 3b357b21b..ead45860d 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -11,6 +11,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" diff --git a/docs/make.jl b/docs/make.jl index 242849139..ffd6e2f3a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,5 +1,22 @@ using Documenter, DocumenterCitations using ClimaTimeSteppers +using Literate + +tutorial_basedir = "tutorials" +tutorial_basedir_from_here = joinpath(@__DIR__, "src", tutorial_basedir) + +jl_files_in_basedir = filter(endswith(".jl"), readdir(tutorial_basedir_from_here)) + +println("Building literate tutorials...") +generated_tutorials = String[] +for filename in jl_files_in_basedir + Literate.markdown( + joinpath(tutorial_basedir_from_here, filename), + tutorial_basedir_from_here; + flavor = Literate.CommonMarkFlavor(), + ) + push!(generated_tutorials, joinpath(tutorial_basedir, replace(filename, ".jl" => ".md"))) +end # https://github.com/jheinen/GR.jl/issues/278#issuecomment-587090846 ENV["GKSwstype"] = "nul" @@ -19,6 +36,7 @@ pages = [ "Test problems" => [ "test_problems/index.md", ], + "Tutorials" => generated_tutorials, "API docs" => [ "ODE Solvers" => "api/ode_solvers.md", "Newtons Method" => "api/newtons_method.md",