1- using MultiDocumenter, Documenter
1+ import Pkg
2+ Pkg. develop (path= " ." ) # Maybe register JuliaAstroDocs at some point?
3+
4+ using MultiDocumenter, Documenter, JuliaAstroDocs
25using LibGit2, Pkg, TOML, UUIDs, Downloads
36
47# This make file compiles the documentation for the JuliaAstro website.
@@ -54,55 +57,29 @@ makedocs(
5457)
5558
5659@info " Building aggregate JuliaAstro site"
57- import Markdown
58- function highlevels (content)
59- arr = []
60- i = 0
61- for line in content
62- if line isa Markdown. Header{2 }
63- push! (arr, [first (line. text), Vector{String}[]])
64- i += 1
65- end
66- if line isa Markdown. Header{3 }
67- push! (last (arr[i]), [first (line. text)])
60+ function generate_multidoc_refs (p; clonedir= joinpath (@__DIR__ , " clones" ))
61+ package_name = string (chopsuffix (p. name, " .jl" ))
62+ multidoc_type = if any (occursin .((" stable" , " dev" ), p. doc)) && startswith (p. doc, " https://juliaastro" )
63+ " MultiDocRef"
64+ else
65+ " Link"
6866 end
69- if line isa Markdown. Paragraph && first (line. content) isa Markdown. Link
70- link_type = strip (last (first (line. content). text))
71- url = first (line. content). url
72- push! (last (last (arr[i])), url)
73- if link_type == " Documentation"
74- multidoc_type = if any (occursin .((" stable" , " dev" ), url)) && startswith (url, " https://juliaastro" )
75- " MultiDocRef"
76- else
77- " Link"
78- end
79- push! (last (last (arr[i])), multidoc_type)
80- end
81- end
82- end
8367
84- return arr
85- end
86-
87- function generate_multidoc_refs (package; clonedir= joinpath (@__DIR__ , " clones" ))
88- package_name = string (chopsuffix (first (package), " .jl" ))
89- if last (package) == " MultiDocRef"
68+ if multidoc_type == " MultiDocRef"
9069 MultiDocumenter. MultiDocRef (
9170 upstream = joinpath (clonedir, package_name),
9271 path = package_name,
9372 name = package_name,
94- giturl = package[ 2 ] ,
73+ giturl = p . repo ,
9574 )
9675 else
9776 MultiDocumenter. Link (
9877 package_name,
99- package[ 3 ] ,
78+ p . doc ,
10079 )
10180 end
10281end
10382
104- ecosystem = read (" ./docs/src/ecosystem.md" ) |> String |> Markdown. parse
105-
10683docs = [
10784 # We also add JuliaAstro's own generated pages
10885 MultiDocumenter. MultiDocRef (
@@ -111,10 +88,10 @@ docs = [
11188 name = " Home" ,
11289 fix_canonical_url = false ,
11390 ),
114- map (highlevels (ecosystem . content) ) do (highlevel, packages)
91+ map (JuliaAstroDocs . ecosystem ) do (highlevel, packages)
11592 MultiDocumenter. DropdownNav (
11693 highlevel,
117- generate_multidoc_refs .(packages)
94+ collect ( generate_multidoc_refs .(packages) )
11895 )
11996 end ...
12097]
0 commit comments