Skip to content

Commit

Permalink
Documenter v1 & warnonly
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Nov 11, 2023
1 parent 5572f3d commit 609db08
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ VoronoiFVM = "82b139dc-5afc-11e9-35da-9b9bdfd336f3"
[compat]
Literate = ">=0.2.7"
Pluto = ">=0.17.4"
Documenter = "1"
56 changes: 29 additions & 27 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Documenter, VoronoiFVM, Literate, PlutoSliderServer, ExtendableGrids, GridVisualize, Pkg
using Documenter,
VoronoiFVM, Literate, PlutoSliderServer, ExtendableGrids, GridVisualize, Pkg
using LinearAlgebra

#
Expand All @@ -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",
Expand All @@ -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")
Expand All @@ -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]
Expand All @@ -84,29 +85,29 @@ function make_all(; with_examples = true, run_notebooks = true, example=nothing)
<iframe style="height:20000px" width="100%" src="../$(base).html"> </iframe>
```
"""
# <iframe sandbox="allow-same-origin" onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';" width="100%" src="../$(base).html"> </iframe>
# <iframe sandbox="allow-same-origin" onload="this.style.height=(this.contentWindow.document.body.scrollHeight+20)+'px';" width="100%" src="../$(base).html"> </iframe>
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 =
Expand All @@ -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 = [
Expand All @@ -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")
Expand Down

0 comments on commit 609db08

Please sign in to comment.