From 090883c515a9a619c5d608506461f0f32c1002d6 Mon Sep 17 00:00:00 2001 From: Joshua Lampert Date: Tue, 20 Aug 2024 14:19:53 +0200 Subject: [PATCH] simplify setting all files in subdirectory in docs --- docs/make.jl | 28 +++++----------------------- docs/src/ref.md | 4 ++-- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index f6ca1870..7cc968de 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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"))) # Define module-wide setups such that the respective modules are available in doctests DocMeta.setdocmeta!(DispersiveShallowWater, :DocTestSetup, :(using DispersiveShallowWater); diff --git a/docs/src/ref.md b/docs/src/ref.md index 713fc9a4..6c6dd9dc 100644 --- a/docs/src/ref.md +++ b/docs/src/ref.md @@ -13,7 +13,7 @@ Pages = ["DispersiveShallowWater.jl"] ```@autodocs Modules = [DispersiveShallowWater] -Pages = EQUATIONS_FILES_TO_BE_INSERTED +Pages = Main.EQUATIONS_FILES ``` ## Mesh @@ -48,7 +48,7 @@ Pages = ["semidiscretization.jl"] ```@autodocs Modules = [DispersiveShallowWater] -Pages = CALLBACKS_STEP_FILES_TO_BE_INSERTED +Pages = Main.CALLBACKS_STEP_FILES ``` ## Utilities