-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* notebook build with PlutoStaticHTML works * PlutoVista -> CairoMakie in notebooks * HTML configuration for Documenter (size threshold, mathjax3) * Use ExampleJuggler to handle tests and docs
- Loading branch information
Showing
60 changed files
with
8,534 additions
and
3,461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
[deps] | ||
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" | ||
DiffResults = "163ba53b-c6d8-5494-b064-1a9d43ac40c5" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
ExampleJuggler = "3bbe58f8-ed81-4c4e-a134-03e85fcf4a1a" | ||
ExtendableGrids = "cfc395e8-590f-11e8-1f13-43a2532b2fa8" | ||
ExtendableSparse = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3" | ||
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" | ||
GridVisualize = "5eed8a63-0fb0-45eb-886d-8d5a387d12b8" | ||
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" | ||
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2" | ||
ILUZero = "88f59080-6952-5380-9ea5-54057fb9a43f" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781" | ||
PlutoSliderServer = "2fc8631c-6f24-4c5b-bca7-cbb509c42db4" | ||
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8" | ||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" | ||
SimplexGridFactory = "57bfcd06-606e-45d6-baf4-4ba06da0efd5" | ||
SparseDiffTools = "47a9eef4-7e08-11e9-0b38-333d64bd3804" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344" | ||
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | ||
VoronoiFVM = "82b139dc-5afc-11e9-35da-9b9bdfd336f3" | ||
|
||
[compat] | ||
Literate = ">=0.2.7" | ||
Pluto = ">=0.17.4" | ||
Documenter = "1" | ||
ExampleJuggler = "0.3.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,175 +1,66 @@ | ||
using Documenter, | ||
VoronoiFVM, Literate, PlutoSliderServer, ExtendableGrids, GridVisualize, Pkg | ||
using LinearAlgebra | ||
|
||
# | ||
# Replace SOURCE_URL marker with github url of source | ||
# | ||
function replace_source_url(input, source_url) | ||
lines_in = collect(eachline(IOBuffer(input))) | ||
lines_out = IOBuffer() | ||
for line in lines_in | ||
println(lines_out, replace(line, "SOURCE_URL" => source_url)) | ||
end | ||
return String(take!(lines_out)) | ||
end | ||
|
||
|
||
|
||
|
||
function make_all(; with_examples = true, run_notebooks = true, example = nothing) | ||
|
||
generated_examples = [] | ||
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) | ||
|
||
if run_notebooks | ||
notebookenv = joinpath(@__DIR__, "..", "pluto-examples") | ||
Pkg.activate(notebookenv) | ||
Pkg.develop(path = joinpath(@__DIR__, "..")) | ||
Pkg.instantiate() | ||
|
||
ENV["PLUTO_PROJECT"] = notebookenv | ||
notebooks = [ | ||
"Outflow boundary conditions" => "outflow.jl", | ||
"Obtaining vector fields" => "flux-reconstruction.jl", | ||
"Internal interfaces (1D)" => "interfaces1d.jl", | ||
"A case for caution" => "problemcase.jl", | ||
"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") | ||
# output=joinpath(@__DIR__,"src","nbhtml",base*".html") | ||
# session = Pluto.ServerSession(); | ||
# 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] | ||
mdstring = """ | ||
##### [$(base).jl](@id $(base)) | ||
[Download](https://github.com/j-fu/VoronoiFVM.jl/blob/master/pluto-examples/$(notebook)) | ||
this [Pluto.jl](https://plutojl.org) this notebook. | ||
```@raw html | ||
<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> | ||
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) | ||
else | ||
example_sources = [example] | ||
end | ||
for example_source in example_sources | ||
base, ext = splitext(example_source) | ||
if ext == ".jl" | ||
source_url = | ||
"https://github.com/j-fu/VoronoiFVM.jl/raw/master/examples/" * | ||
example_source | ||
preprocess(buffer) = replace_source_url(buffer, source_url) | ||
Literate.markdown( | ||
joinpath(@__DIR__, "..", "examples", example_source), | ||
example_md_dir, | ||
documenter = false, | ||
info = false, | ||
preprocess = preprocess, | ||
) | ||
end | ||
end | ||
|
||
|
||
generated_examples = | ||
vcat(["runexamples.md"], joinpath.("examples", readdir(example_md_dir))) | ||
end | ||
|
||
makedocs( | ||
sitename = "VoronoiFVM.jl", | ||
modules = [VoronoiFVM, VoronoiFVM.SolverStrategies], | ||
checkdocs = :all, | ||
clean = false, | ||
doctest = true, | ||
warnonly = true, | ||
authors = "J. Fuhrmann", | ||
repo = "https://github.com/j-fu/VoronoiFVM.jl", | ||
pages = [ | ||
"Home" => "index.md", | ||
"changes.md", | ||
"method.md", | ||
"API Documentation" => [ | ||
"system.md", | ||
"physics.md", | ||
"solutions.md", | ||
"solver.md", | ||
"post.md", | ||
"quantities.md", | ||
"misc.md", | ||
"internal.md", | ||
"allindex.md", | ||
"devel.md", | ||
], | ||
"Tutorial Notebooks" => notebooks, | ||
"Examples" => generated_examples, | ||
], | ||
) | ||
|
||
with_examples && rm(example_md_dir, recursive = true, force = true) | ||
run_notebooks && rm(notebook_html_dir, recursive = true, force = true) | ||
using Documenter, ExampleJuggler, VoronoiFVM, ExtendableGrids | ||
|
||
function make_all(; with_examples = true, with_notebooks = true, example = nothing) | ||
ExampleJuggler.verbose!(true) | ||
|
||
cleanexamples() | ||
notebookdir = joinpath(@__DIR__, "..", "pluto-examples") | ||
exampledir = joinpath(@__DIR__, "..", "examples") | ||
|
||
notebooks = [ | ||
"Outflow boundary conditions" => "outflow.jl", | ||
"Obtaining vector fields" => "flux-reconstruction.jl", | ||
"Internal interfaces (1D)" => "interfaces1d.jl", | ||
"A case for caution" => "problemcase.jl", | ||
"Nonlinear solver control" => "nonlinear-solvers.jl", | ||
"API Updates" => "api-update.jl", | ||
] | ||
notebook_examples = @docplutonotebooks(notebookdir, notebooks, iframe=false) | ||
notebook_examples = vcat(["About the notebooks" => "notebooks.md"], notebook_examples) | ||
|
||
modules = filter(ex -> splitext(ex)[2] == ".jl", basename.(readdir(exampledir))) | ||
module_examples = @docmodules(exampledir, modules) | ||
module_examples = vcat(["About the examples" => "runexamples.md"], module_examples) | ||
|
||
makedocs(; sitename = "VoronoiFVM.jl", | ||
modules = [VoronoiFVM, VoronoiFVM.SolverStrategies], | ||
checkdocs = :all, | ||
clean = false, | ||
doctest = false, | ||
warnonly = true, | ||
authors = "J. Fuhrmann", | ||
repo = "https://github.com/j-fu/VoronoiFVM.jl", | ||
format = Documenter.HTML(; size_threshold_ignore = last.(notebook_examples), | ||
mathengine = MathJax3()), | ||
pages = [ | ||
"Home" => "index.md", | ||
"changes.md", | ||
"method.md", | ||
"API Documentation" => [ | ||
"system.md", | ||
"physics.md", | ||
"solutions.md", | ||
"solver.md", | ||
"post.md", | ||
"quantities.md", | ||
"misc.md", | ||
"internal.md", | ||
"allindex.md", | ||
"devel.md", | ||
], | ||
"Tutorial Notebooks" => notebook_examples, | ||
"Examples" => module_examples, | ||
]) | ||
|
||
cleanexamples() | ||
|
||
if !isinteractive() | ||
deploydocs(repo = "github.com/j-fu/VoronoiFVM.jl.git") | ||
deploydocs(; repo = "github.com/j-fu/VoronoiFVM.jl.git") | ||
end | ||
end | ||
|
||
if isinteractive() | ||
make_all(with_examples = false, run_notebooks = false) | ||
make_all(; with_examples = false, with_notebooks = false) | ||
else | ||
make_all(with_examples = true, run_notebooks = true) | ||
make_all(; with_examples = true, with_notebooks = true) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.