Skip to content

Commit 6322685

Browse files
authored
Merge pull request #53 from JuliaComputing/sp/disable-previews
feat: add `hide_previews` arg
2 parents 0eeb757 + 7dddedc commit 6322685

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/MultiDocumenter.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ const DEFAULT_ENGINE = SearchConfig(index_versions = ["stable", "dev"], engine =
8989
custom_scripts = [],
9090
search_engine = SearchConfig(),
9191
prettyurls = true,
92-
rootpath = "/"
92+
rootpath = "/",
93+
hide_previews = true,
9394
)
9495
9596
Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`.
@@ -102,7 +103,8 @@ Aggregates multiple Documenter.jl-based documentation pages `docs` into `outdir`
102103
`Docs.HTML` objects are inserted as the content of inline scripts.
103104
- `search_engine` inserts a global search bar if not `false`. See [`SearchConfig`](@ref) for more details.
104105
- `prettyurls` removes all `index.html` suffixes from links in the global navigation.
105-
-`rootpath` is the path your site ends up being deployed at, e.g. `/foo/` if it's hosted at `https://bar.com/foo`
106+
- `rootpath` is the path your site ends up being deployed at, e.g. `/foo/` if it's hosted at `https://bar.com/foo`
107+
- `hide_previews` removes preview builds from the aggregated documentation.
106108
"""
107109
function make(
108110
outdir,
@@ -114,10 +116,11 @@ function make(
114116
search_engine = DEFAULT_ENGINE,
115117
prettyurls = true,
116118
rootpath = "/",
119+
hide_previews = true,
117120
)
118121
maybe_clone(flatten_multidocrefs(docs))
119122

120-
dir = make_output_structure(flatten_multidocrefs(docs), prettyurls)
123+
dir = make_output_structure(flatten_multidocrefs(docs), prettyurls, hide_previews)
121124
out_assets = joinpath(dir, "assets")
122125
if assets_dir !== nothing && isdir(assets_dir)
123126
cp(assets_dir, out_assets)
@@ -189,7 +192,7 @@ function maybe_clone(docs::Vector{MultiDocRef})
189192
end
190193
end
191194

192-
function make_output_structure(docs::Vector{MultiDocRef}, prettyurls)
195+
function make_output_structure(docs::Vector{MultiDocRef}, prettyurls, hide_previews)
193196
dir = mktempdir()
194197

195198
for doc in docs
@@ -202,6 +205,11 @@ function make_output_structure(docs::Vector{MultiDocRef}, prettyurls)
202205
if isdir(gitpath)
203206
rm(gitpath, recursive = true)
204207
end
208+
209+
previewpath = joinpath(outpath, "previews")
210+
if hide_previews && isdir(previewpath)
211+
rm(previewpath, recursive = true)
212+
end
205213
end
206214

207215
open(joinpath(dir, "index.html"), "w") do io

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ using Test
9898

9999
@testset "structure" begin
100100
@test isdir(outpath, "inf")
101+
@test !isdir(outpath, "inf", "previews")
101102
@test isdir(outpath, "inf", "stable")
102103
@test isfile(outpath, "inf", "stable", "index.html")
103104

0 commit comments

Comments
 (0)