Skip to content

Commit f8a9e74

Browse files
committed
add docs
1 parent c793e5e commit f8a9e74

8 files changed

Lines changed: 171 additions & 1 deletion

File tree

.github/workflows/doccleanup.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
doc-preview-cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout gh-pages branch
12+
uses: actions/checkout@v3
13+
with:
14+
ref: gh-pages
15+
16+
- name: Delete preview and history
17+
run: |
18+
git config user.name "Documenter.jl"
19+
git config user.email "documenter@juliadocs.github.io"
20+
git rm -rf "previews/PR$PRNUM"
21+
git commit -m "delete preview"
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
23+
env:
24+
PRNUM: ${{ github.event.number }}
25+
26+
- name: Push changes
27+
run: |
28+
git push --force origin gh-pages-new:gh-pages
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags: '*'
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
permissions:
13+
contents: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: julia-actions/setup-julia@v1
18+
with:
19+
version: '1'
20+
- name: Install dependencies
21+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
22+
- name: Build and deploy
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
25+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
26+
run: julia --project=docs/ docs/make.jl

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
docs/build
55
deps/build.log
66
Manifest.toml
7+
*.scss
8+
*.css

docs/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
4+
PredefinedDynamicalSystems = "31e2f376-db9e-427a-b76e-a14f56347a14"

docs/make.jl

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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

docs/src/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# PredefinedDynamicalSystems.jl
2+
3+
```@docs
4+
PredefinedDynamicalSystems
5+
```
6+
7+
---
8+
9+
All currently implemented predefined systems are listed below:
10+
```@autodocs
11+
Modules = [PredefinedDynamicalSystems]
12+
Order = [:function]
13+
```

docs/style.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# %% Color theme definitions
2+
struct CyclicContainer <: AbstractVector{String}
3+
c::Vector{String}
4+
n::Int
5+
end
6+
CyclicContainer(c) = CyclicContainer(c, 0)
7+
8+
Base.length(c::CyclicContainer) = length(c.c)
9+
Base.size(c::CyclicContainer) = size(c.c)
10+
Base.iterate(c::CyclicContainer, state=1) = Base.iterate(c.c, state)
11+
Base.getindex(c::CyclicContainer, i) = c.c[(i-1)%length(c.c) + 1]
12+
Base.getindex(c::CyclicContainer, i::AbstractArray) = c.c[i]
13+
function Base.getindex(c::CyclicContainer)
14+
c.n += 1
15+
c[c.n]
16+
end
17+
Base.iterate(c::CyclicContainer, i = 1) = iterate(c.c, i)
18+
19+
COLORSCHEME = [
20+
"#6D44D0",
21+
"#2CB3BF",
22+
"#1B1B1B",
23+
"#DA5210",
24+
"#03502A",
25+
"#866373",
26+
]
27+
28+
COLORS = CyclicContainer(COLORSCHEME)
29+
LINESTYLES = CyclicContainer(["-", ":", "--", "-."])
30+
31+
# %% Makie styling
32+
# other styling elements for Makie
33+
set_theme!(;
34+
palette = (color = COLORSCHEME,),
35+
fontsize = 22,
36+
figure_padding = 4,
37+
resolution = (1000, 500),
38+
linewidth = 3.0,
39+
)

src/PredefinedDynamicalSystems.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ The alias `Systems` is exported by `DynamicalSystems`.
44
55
This module is provided purely as a convenience.
66
Nothing here is tested, nor guaranteed to be stable in future versions.
7+
It is not recommended to use this module for anything else besides
8+
on-the-spot demonstrative examples.
79
8-
Predefined systems exist functions that
10+
Predefined systems exist as functions that
911
return a `DynamicalSystem` instance. They are accessed like:
1012
```julia
1113
ds = PredefinedDynamicalSystems.lorenz(u0; ρ = 32.0)

0 commit comments

Comments
 (0)