Skip to content

Commit 932a304

Browse files
committed
add docs for MultiDocRef, improve error handling
1 parent 735b92e commit 932a304

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/MultiDocumenter.jl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,30 @@ Base.@kwdef mutable struct SearchConfig
2525
lowfi = false
2626
end
2727

28+
"""
29+
struct MultiDocRef
30+
31+
Represents one set of docs that will get an entry in the MultiDocumenter navigation.
32+
33+
**Required arguments:**
34+
35+
* `upstream`: the local directory where the documentation is located. If `giturl` is passed,
36+
MultiDocumenter will clone into this directory.
37+
* `name`: string used in the MultiDocumenter navigation for this item
38+
* `path`: the URL path under which the contents of upstream is placed
39+
40+
**Optional arguments:**
41+
42+
* `giturl`: URL of the remote Git repository that will be cloned. If this is unset, then `upstream` must be an existing directory.
43+
* `branch`: Git branch of `giturl` where the docs will be pulled from (defaults to `gh-pages`)
44+
* `fix_canonical_url`: this can be set to `false` to disable the canonical URL fixing
45+
for this `MultiDocRef` (see also `canonical_domain` for [`make`](@ref)).
46+
"""
2847
struct MultiDocRef
2948
upstream::String
30-
3149
path::String
3250
name::String
33-
3451
fix_canonical_url::Bool
35-
36-
# these are not actually used internally
3752
giturl::String
3853
branch::String
3954
end
@@ -263,6 +278,11 @@ end
263278
function maybe_clone(docs::Vector{MultiDocRef})
264279
for doc in docs
265280
if !isdir(doc.upstream)
281+
if isempty(doc.giturl)
282+
error(
283+
"MultiDocRef for $(doc.name): if giturl= is not passed, then upstream= must be an existing directory",
284+
)
285+
end
266286
@info "Upstream at $(doc.upstream) does not exist. `git clone`ing `$(doc.giturl)#$(doc.branch)`"
267287
run(
268288
`$(git()) clone --depth 1 $(doc.giturl) --branch $(doc.branch) --single-branch --no-tags $(doc.upstream)`,

0 commit comments

Comments
 (0)