-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmake.jl
136 lines (124 loc) · 3.97 KB
/
make.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import JuliaAstroDocs
using MultiDocumenter, Documenter
using LibGit2, Pkg, TOML, UUIDs, Downloads
# This make file compiles the documentation for the JuliaAstro website.
# It consists of the usual documenter structure, but also follows the approach
# of the SciML docs page https://github.com/SciML/SciMLDocs/blob/main/docs/make.jl
# by generating nested documentation for packages under the JuliaAstro organization.
# That way, docs for all packages are browsable and searchable in one place!
clonedir = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "clones")
outpath = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "build")
@info """
Cloning packages into: $(clonedir)
Building aggregate site into: $(outpath)
"""
@info "Building MultiDocumenter site for JuliaAstro"
mathengine = MathJax3(Dict(
:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
:tex => Dict(
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
"packages" => ["base", "ams", "autoload", "mathtools", "require"],
),
))
makedocs(
sitename = "JuliaAstro",
authors = "Julia Astro Contributors",
clean = true,
doctest = false,
format = Documenter.HTML(;
mathengine,
prettyurls = get(ENV, "CI", "false") == "true",
canonical = "https://JuliaAstro.org/",
assets = String[
"assets/styles.css",
"assets/favicon.ico",
],
inventory_version = "",
edit_link = "source",
),
pages = [
"Home" => "index.md",
"Tutorials" => [
"tutorials/index.md",
"General" => [
"tutorials/jwst-image-scale-bar.md",
"tutorials/tabular-data.md",
"tutorials/curve-fit.md",
],
],
"Ecosystem" => "ecosystem.md",
"Comparison with Astropy" => "comparison.md",
],
warnonly = [:missing_docs],
)
@info "Building aggregate JuliaAstro site"
function generate_multidoc_refs(p; clonedir=joinpath(@__DIR__, "clones"))
package_name = string(chopsuffix(p.name, ".jl"))
multidoc_type = if any(occursin.(("stable", "dev"), p.doc)) && startswith(p.doc, "https://juliaastro")
"MultiDocRef"
else
"Link"
end
if multidoc_type == "MultiDocRef"
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, package_name),
path = package_name,
name = package_name,
giturl = p.repo,
)
else
MultiDocumenter.Link(
package_name,
p.doc,
)
end
end
docs = [
# We also add JuliaAstro's own generated pages
MultiDocumenter.MultiDocRef(
upstream = joinpath(@__DIR__, "build"),
path = "home",
name = "Home",
fix_canonical_url = false,
),
map(JuliaAstroDocs.ecosystem) do (highlevel, packages)
MultiDocumenter.DropdownNav(
highlevel,
collect(generate_multidoc_refs.(packages))
)
end...
]
MultiDocumenter.make(
outpath,
docs;
assets_dir = "docs/src/assets",
search_engine = MultiDocumenter.SearchConfig(
index_versions = ["stable"],
engine = MultiDocumenter.FlexSearch
),
rootpath = "/",
canonical_domain = "https://JuliaAstro.org/",
brand_image = MultiDocumenter.BrandImage(".", joinpath("assets", "logo.svg")),
sitemap = true,
)
@info "Aggregate build done"
# Download logo
assets_dir = joinpath(outpath, "assets")
mkpath(assets_dir)
Downloads.download(
"https://raw.githubusercontent.com/JuliaAstro/JuliaAstro.github.io/refs/heads/source/docs/src/assets/logo.svg",
joinpath(assets_dir, "logo.svg");
verbose = true,
)
@info "Final build done"
@info "Deploying docs"
deploydocs(;
repo = "github.com/JuliaAstro/JuliaAstro.github.io",
push_preview = true,
branch = "master",
devbranch = "source",
devurl = "home",
cname = "juliaastro.org",
versions = nothing,
)
@info "Deploy complete"