diff --git a/docs/Project.toml b/docs/Project.toml index d447000ee..567ab3d22 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -15,3 +15,4 @@ VoronoiFVM = "82b139dc-5afc-11e9-35da-9b9bdfd336f3" [compat] Literate = ">=0.2.7" Pluto = ">=0.17.4" +Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index e1477281e..f4ef405b0 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,4 +1,5 @@ -using Documenter, VoronoiFVM, Literate, PlutoSliderServer, ExtendableGrids, GridVisualize, Pkg +using Documenter, + VoronoiFVM, Literate, PlutoSliderServer, ExtendableGrids, GridVisualize, Pkg using LinearAlgebra # @@ -16,25 +17,25 @@ end -function make_all(; with_examples = true, run_notebooks = true, example=nothing) +function make_all(; with_examples = true, run_notebooks = true, example = nothing) generated_examples = [] - notebooks = [] + notebooks = [] notebooks = [] example_jl_dir = joinpath(@__DIR__, "..", "examples") example_md_dir = joinpath(@__DIR__, "src", "examples") notebook_html_dir = joinpath(@__DIR__, "src", "nbhtml") - - with_examples && rm(example_md_dir, recursive = true, force=true) - run_notebooks && rm(notebook_html_dir, recursive = true, force=true) - + + with_examples && rm(example_md_dir, recursive = true, force = true) + run_notebooks && rm(notebook_html_dir, recursive = true, force = true) + if run_notebooks - notebookenv=joinpath(@__DIR__,"..","pluto-examples") + notebookenv = joinpath(@__DIR__, "..", "pluto-examples") Pkg.activate(notebookenv) - Pkg.develop(path=joinpath(@__DIR__, "..")) + Pkg.develop(path = joinpath(@__DIR__, "..")) Pkg.instantiate() - ENV["PLUTO_PROJECT"]=notebookenv + ENV["PLUTO_PROJECT"] = notebookenv notebooks = [ "Outflow boundary conditions" => "outflow.jl", "Obtaining vector fields" => "flux-reconstruction.jl", @@ -43,10 +44,10 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing) "Nonlinear solver control" => "nonlinear-solvers.jl", "API Updates" => "api-update.jl", ] - + notebookjl = last.(notebooks) notebookmd = [] - + # function rendernotebook(name) # base=split(name,".")[1] # input=joinpath(@__DIR__,"..","pluto-examples",base*".jl") @@ -55,22 +56,22 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing) # html_contents=PlutoStaticHTML.notebook2html(input;session) # write(output, html_contents) # end - - + + # for notebook in notebookjl # @info "Converting $(notebook)" # rendernotebook(notebook) # end - - + + export_directory( joinpath(@__DIR__, "..", "pluto-examples"), notebook_paths = notebookjl, Export_output_dir = joinpath(notebook_html_dir), Export_offer_binder = false, ) - + # generate frame markdown for each notebook for notebook in notebookjl base = split(notebook, ".")[1] @@ -84,29 +85,29 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing) ``` """ -# + # mdname = base * ".md" push!(notebookmd, joinpath("nbhtml", mdname)) io = open(joinpath(notebook_html_dir, mdname), "w") write(io, mdstring) close(io) end - + notebooks = first.(notebooks) .=> notebookmd pushfirst!(notebooks, "About the notebooks" => "notebooks.md") end - + if with_examples # # Generate Markdown pages from examples # - if example==nothing - example_sources=readdir(example_jl_dir) + if example == nothing + example_sources = readdir(example_jl_dir) else - example_sources=[example] + example_sources = [example] end - for example_source in example_sources + for example_source in example_sources base, ext = splitext(example_source) if ext == ".jl" source_url = @@ -130,10 +131,11 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing) makedocs( sitename = "VoronoiFVM.jl", - modules = [VoronoiFVM,VoronoiFVM.SolverStrategies], + modules = [VoronoiFVM, VoronoiFVM.SolverStrategies], checkdocs = :all, clean = false, doctest = true, + warnonly = true, authors = "J. Fuhrmann", repo = "https://github.com/j-fu/VoronoiFVM.jl", pages = [ @@ -157,8 +159,8 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing) ], ) - with_examples && rm(example_md_dir, recursive = true, force=true) - run_notebooks && rm(notebook_html_dir, recursive = true, force=true) + with_examples && rm(example_md_dir, recursive = true, force = true) + run_notebooks && rm(notebook_html_dir, recursive = true, force = true) if !isinteractive() deploydocs(repo = "github.com/j-fu/VoronoiFVM.jl.git")