Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify setting all files in subdirectory in docs #145

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,12 @@ using DispersiveShallowWater
using TrixiBase
using Changelog: Changelog

# Dynamically replace all files in subdirectories of the source directory to include all files in these subdirectories
# Dynamically set all files in subdirectories of the source directory to include all files in these subdirectories
# This way they don't need to be listed explicitly
EQUATIONS_FILES_TO_BE_INSERTED = joinpath.(Ref("equations"),
readdir(joinpath(dirname(@__DIR__), "src",
"equations")))
CALLBACKS_STEP_FILES_TO_BE_INSERTED = joinpath.(Ref("callbacks_step"),
readdir(joinpath(dirname(@__DIR__), "src",
"callbacks_step")))

ref_path = joinpath(@__DIR__, "src", "ref.md")
lines = readlines(ref_path)
open(ref_path, "w") do io
for line in lines
if contains(line, "EQUATIONS_FILES_TO_BE_INSERTED")
line = replace(line,
"EQUATIONS_FILES_TO_BE_INSERTED" => EQUATIONS_FILES_TO_BE_INSERTED)
end
if contains(line, "CALLBACKS_STEP_FILES_TO_BE_INSERTED")
line = replace(line,
"CALLBACKS_STEP_FILES_TO_BE_INSERTED" => CALLBACKS_STEP_FILES_TO_BE_INSERTED)
end
println(io, line)
end
end
EQUATIONS_FILES = joinpath.(Ref("equations"), readdir(joinpath(dirname(@__DIR__), "src",
"equations")))
CALLBACKS_STEP_FILES = joinpath.(Ref("callbacks_step"), readdir(joinpath(dirname(@__DIR__), "src",
"callbacks_step")))
JoshuaLampert marked this conversation as resolved.
Show resolved Hide resolved

# Define module-wide setups such that the respective modules are available in doctests
DocMeta.setdocmeta!(DispersiveShallowWater, :DocTestSetup, :(using DispersiveShallowWater);
Expand Down
4 changes: 2 additions & 2 deletions docs/src/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pages = ["DispersiveShallowWater.jl"]

```@autodocs
Modules = [DispersiveShallowWater]
Pages = EQUATIONS_FILES_TO_BE_INSERTED
Pages = Main.EQUATIONS_FILES
```

## Mesh
Expand Down Expand Up @@ -48,7 +48,7 @@ Pages = ["semidiscretization.jl"]

```@autodocs
Modules = [DispersiveShallowWater]
Pages = CALLBACKS_STEP_FILES_TO_BE_INSERTED
Pages = Main.CALLBACKS_STEP_FILES
```

## Utilities
Expand Down
Loading