diff --git a/src/MultiDocumenter.jl b/src/MultiDocumenter.jl index 9b2837e0..3ccb0b79 100644 --- a/src/MultiDocumenter.jl +++ b/src/MultiDocumenter.jl @@ -89,7 +89,8 @@ const DEFAULT_ENGINE = SearchConfig(index_versions = ["stable", "dev"], engine = custom_scripts = [], search_engine = SearchConfig(), prettyurls = true, - rootpath = "/" + rootpath = "/", + hide_previews = true, ) Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`. @@ -102,7 +103,8 @@ Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir` `Docs.HTML` objects are inserted as the content of inline scripts. - `search_engine` inserts a global search bar if not `false`. See [`SearchConfig`](@ref) for more details. - `prettyurls` removes all `index.html` suffixes from links in the global navigation. --`rootpath` is the path your site ends up being deployed at, e.g. `/foo/` if it's hosted at `https://bar.com/foo` +- `rootpath` is the path your site ends up being deployed at, e.g. `/foo/` if it's hosted at `https://bar.com/foo` +- `hide_previews` removes preview builds from the aggregated documentation. """ function make( outdir, @@ -114,10 +116,11 @@ function make( search_engine = DEFAULT_ENGINE, prettyurls = true, rootpath = "/", + hide_previews = true, ) maybe_clone(flatten_multidocrefs(docs)) - dir = make_output_structure(flatten_multidocrefs(docs), prettyurls) + dir = make_output_structure(flatten_multidocrefs(docs), prettyurls, hide_previews) out_assets = joinpath(dir, "assets") if assets_dir !== nothing && isdir(assets_dir) cp(assets_dir, out_assets) @@ -189,7 +192,7 @@ function maybe_clone(docs::Vector{MultiDocRef}) end end -function make_output_structure(docs::Vector{MultiDocRef}, prettyurls) +function make_output_structure(docs::Vector{MultiDocRef}, prettyurls, hide_previews) dir = mktempdir() for doc in docs @@ -202,6 +205,11 @@ function make_output_structure(docs::Vector{MultiDocRef}, prettyurls) if isdir(gitpath) rm(gitpath, recursive = true) end + + previewpath = joinpath(outpath, "previews") + if hide_previews && isdir(previewpath) + rm(previewpath, recursive = true) + end end open(joinpath(dir, "index.html"), "w") do io diff --git a/test/runtests.jl b/test/runtests.jl index aa01f176..f0c668a0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -98,6 +98,7 @@ using Test @testset "structure" begin @test isdir(outpath, "inf") + @test !isdir(outpath, "inf", "previews") @test isdir(outpath, "inf", "stable") @test isfile(outpath, "inf", "stable", "index.html")