|
| 1 | +cd(@__DIR__) |
| 2 | +CI = get(ENV, "CI", nothing) == "true" || get(ENV, "GITHUB_TOKEN", nothing) !== nothing |
| 3 | +using PredefinedDynamicalSystems # comes from global environment in CI |
| 4 | +using Documenter |
| 5 | +using DocumenterTools: Themes |
| 6 | +ENV["JULIA_DEBUG"] = "Documenter" |
| 7 | + |
| 8 | +# %% JuliaDynamics theme |
| 9 | +# It includes themeing for the HTML build |
| 10 | +# and themeing for the Makie plotting |
| 11 | + |
| 12 | +using DocumenterTools: Themes |
| 13 | +for file in ("juliadynamics-lightdefs.scss", "juliadynamics-darkdefs.scss", "juliadynamics-style.scss") |
| 14 | + filepath = joinpath(@__DIR__, file) |
| 15 | + if !isfile(filepath) |
| 16 | + download("https://raw.githubusercontent.com/JuliaDynamics/doctheme/master/$file", joinpath(@__DIR__, file)) |
| 17 | + end |
| 18 | +end |
| 19 | +# create the themes |
| 20 | +for w in ("light", "dark") |
| 21 | + header = read(joinpath(@__DIR__, "juliadynamics-style.scss"), String) |
| 22 | + theme = read(joinpath(@__DIR__, "juliadynamics-$(w)defs.scss"), String) |
| 23 | + write(joinpath(@__DIR__, "juliadynamics-$(w).scss"), header*"\n"*theme) |
| 24 | +end |
| 25 | +# compile the themes |
| 26 | +Themes.compile(joinpath(@__DIR__, "juliadynamics-light.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-light.css")) |
| 27 | +Themes.compile(joinpath(@__DIR__, "juliadynamics-dark.scss"), joinpath(@__DIR__, "src/assets/themes/documenter-dark.css")) |
| 28 | + |
| 29 | +# %% Build docs |
| 30 | +ENV["JULIA_DEBUG"] = "Documenter" |
| 31 | + |
| 32 | +include("style.jl") |
| 33 | + |
| 34 | +makedocs( |
| 35 | + modules = [PredefinedDynamicalSystems], |
| 36 | + format = Documenter.HTML( |
| 37 | + prettyurls = CI, |
| 38 | + assets = [ |
| 39 | + asset("https://fonts.googleapis.com/css?family=Montserrat|Source+Code+Pro&display=swap", class=:css), |
| 40 | + ], |
| 41 | + collapselevel = 3, |
| 42 | + ), |
| 43 | + sitename = "PredefinedDynamicalSystems.jl", |
| 44 | + authors = "George Datseris", |
| 45 | + pages = ["index.md"], |
| 46 | + doctest = false, |
| 47 | + draft = false, |
| 48 | +) |
| 49 | + |
| 50 | +if CI |
| 51 | + deploydocs( |
| 52 | + repo = "github.com/JuliaDynamics/PredefinedDynamicalSystems.jl.git", |
| 53 | + target = "build", |
| 54 | + push_preview = true |
| 55 | + ) |
| 56 | +end |
0 commit comments