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