forked from trixi-framework/Trixi.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.jl
146 lines (136 loc) · 6.06 KB
/
make.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using Documenter
import Pkg
# Fix for https://github.com/trixi-framework/Trixi.jl/issues/668
if (get(ENV, "CI", nothing) != "true") && (get(ENV, "TRIXI_DOC_DEFAULT_ENVIRONMENT", nothing) != "true")
push!(LOAD_PATH, dirname(@__DIR__))
end
using Trixi
using Trixi2Vtk
using TrixiBase
# Get Trixi.jl root directory
trixi_root_dir = dirname(@__DIR__)
include(joinpath(trixi_root_dir, "docs", "literate", "make.jl"))
# Copy list of authors to not need to synchronize it manually
authors_text = read(joinpath(trixi_root_dir, "AUTHORS.md"), String)
authors_text = replace(authors_text, "in the [LICENSE.md](LICENSE.md) file" => "under [License](@ref)")
write(joinpath(@__DIR__, "src", "authors.md"), authors_text)
# Define module-wide setups such that the respective modules are available in doctests
DocMeta.setdocmeta!(Trixi, :DocTestSetup, :(using Trixi); recursive=true)
DocMeta.setdocmeta!(Trixi2Vtk, :DocTestSetup, :(using Trixi2Vtk); recursive=true)
# Copy some files from the repository root directory to the docs and modify them
# as necessary
# Based on: https://github.com/ranocha/SummationByPartsOperators.jl/blob/0206a74140d5c6eb9921ca5021cb7bf2da1a306d/docs/make.jl#L27-L41
open(joinpath(@__DIR__, "src", "code_of_conduct.md"), "w") do io
# Point to source license file
println(io, """
```@meta
EditURL = "https://github.com/trixi-framework/Trixi.jl/blob/main/CODE_OF_CONDUCT.md"
```
""")
# Write the modified contents
println(io, "# [Code of Conduct](@id code-of-conduct)")
println(io, "")
for line in eachline(joinpath(dirname(@__DIR__), "CODE_OF_CONDUCT.md"))
line = replace(line, "[AUTHORS.md](AUTHORS.md)" => "[Authors](@ref)")
println(io, "> ", line)
end
end
# Create tutorials for the following files:
# Normal structure: "title" => "filename.jl"
# If there are several files for one topic and one folder, the structure is:
# "title" => ["subtitle 1" => ("folder 1", "filename 1.jl"),
# "subtitle 2" => ("folder 2", "filename 2.jl")]
files = [
# Topic: introduction
"First steps in Trixi.jl" => [
"Getting started" => ("first_steps", "getting_started.jl"),
"Create first setup" => ("first_steps", "create_first_setup.jl"),
"Changing Trixi.jl itself" => ("first_steps", "changing_trixi.jl"),
],
# Topic: DG semidiscretizations
"Introduction to DG methods" => "scalar_linear_advection_1d.jl",
"DGSEM with flux differencing" => "DGSEM_FluxDiff.jl",
"Shock capturing with flux differencing and stage limiter" => "shock_capturing.jl",
"Non-periodic boundaries" => "non_periodic_boundaries.jl",
"DG schemes via `DGMulti` solver" => "DGMulti_1.jl",
"Other SBP schemes (FD, CGSEM) via `DGMulti` solver" => "DGMulti_2.jl",
"Upwind FD SBP schemes" => "upwind_fdsbp.jl",
# Topic: equations
"Adding a new scalar conservation law" => "adding_new_scalar_equations.jl",
"Adding a non-conservative equation" => "adding_nonconservative_equation.jl",
"Parabolic terms" => "parabolic_terms.jl",
"Adding new parabolic terms" => "adding_new_parabolic_terms.jl",
# Topic: meshes
"Adaptive mesh refinement" => "adaptive_mesh_refinement.jl",
"Structured mesh with curvilinear mapping" => "structured_mesh_mapping.jl",
"Unstructured meshes with HOHQMesh.jl" => "hohqmesh_tutorial.jl",
"P4est mesh from gmsh" => "p4est_from_gmsh.jl",
# Topic: other stuff
"Explicit time stepping" => "time_stepping.jl",
"Differentiable programming" => "differentiable_programming.jl",
"Custom semidiscretizations" => "custom_semidiscretization.jl"
]
tutorials = create_tutorials(files)
# Make documentation
makedocs(
# Specify modules for which docstrings should be shown
modules = [Trixi, TrixiBase, Trixi2Vtk],
# Set sitename to Trixi.jl
sitename = "Trixi.jl",
# Provide additional formatting options
format = Documenter.HTML(
# Disable pretty URLs during manual testing
prettyurls = get(ENV, "CI", nothing) == "true",
# Explicitly add favicon as asset
assets = ["assets/favicon.ico"],
# Set canonical URL to GitHub pages URL
canonical = "https://trixi-framework.github.io/Trixi.jl/stable",
size_threshold_ignore = ["reference-trixi.md"]
),
# Explicitly specify documentation structure
pages = [
"Home" => "index.md",
"Getting started" => [
"Overview" => "overview.md",
"Visualization" => "visualization.md",
"Restart simulation" => "restart.md",
],
"Tutorials" => tutorials,
"Basic building blocks" => [
"Meshes" => [
"Tree mesh" => joinpath("meshes", "tree_mesh.md"),
"Structured mesh" => joinpath("meshes", "structured_mesh.md"),
"Unstructured mesh" => joinpath("meshes", "unstructured_quad_mesh.md"),
"P4est-based mesh" => joinpath("meshes", "p4est_mesh.md"),
"DGMulti mesh" => joinpath("meshes", "dgmulti_mesh.md"),
],
"Time integration" => "time_integration.md",
"Callbacks" => "callbacks.md",
"Coupling" => "multi-physics_coupling.md"
],
"Advanced topics & developers" => [
"Conventions" =>"conventions.md",
"Development" => "development.md",
"GitHub & Git" => "github-git.md",
"Style guide" => "styleguide.md",
"Testing" => "testing.md",
"Performance" => "performance.md",
"Parallelization" => "parallelization.md",
],
"Troubleshooting and FAQ" => "troubleshooting.md",
"Reference" => [
"Trixi.jl" => "reference-trixi.md",
"TrixiBase.jl" => "reference-trixibase.md",
"Trixi2Vtk.jl" => "reference-trixi2vtk.md"
],
"Authors" => "authors.md",
"Contributing" => "contributing.md",
"Code of Conduct" => "code_of_conduct.md",
"License" => "license.md",
]
)
deploydocs(
repo = "github.com/trixi-framework/Trixi.jl",
devbranch = "main",
push_preview = true
)