11using Documenter
22using Markdown
3+ using JSON
34
45# Types and functions to generate a Markdown table with links to package badges etc.
56struct PackageDefinition
67 name :: String
78 url :: String
9+ desc :: String
810 docs :: Vector{Pair{String, String}} # type => URL
911 buildbadges :: Vector{Pair{String, String}} # badge => URL
1012end
@@ -26,19 +28,71 @@ function markdown(p::PackageDefinition)
2628 )
2729 for (image, url) in p. buildbadges
2830 ])
31+ push! (row, Markdown. parse (p. desc))
2932end
3033
3134function package_table_markdown (packages)
32- titles = map ([" Package" , " Documentation" , " Coverage" ]) do s
35+ titles = map ([" Package" , " Documentation" , " Coverage" , " Description " ]) do s
3336 Markdown. Bold (s)
3437 end
35- table = Markdown. Table ([titles], [:l , :c , :c ])
38+ table = Markdown. Table ([titles], [:l , :l , :l , :l ])
3639 for p in packages
3740 push! (table. rows, markdown (p))
3841 end
3942 Markdown. MD (table)
4043end
4144
45+ function generate_package_table_markdown ()
46+ # query information about all JuliaDocs repositories
47+ data = read (` gh repo list JuliaDocs --json "isArchived,description,homepageUrl,name,url,defaultBranchRef"` , String)
48+ repos = JSON. parse (data)
49+
50+ # exclude archived repositories
51+ repos = filter! (x -> ! x[" isArchived" ], repos)
52+
53+ # exclude some other repositories
54+ excluded = [
55+ " DocumentationGeneratorRegistry" , # kinda obsolete
56+ " DocumenterInventoryWritingBackport.jl" ,
57+ " juliadocs.github.io" , # this repository, no point linking to it
58+ " Julia-Cheat-Sheet" , # not a package
59+ ]
60+ filter! (x -> x[" name" ] ∉ excluded, repos)
61+
62+ # sort alphabetical
63+ sort! (repos, by = x -> x[" name" ])
64+
65+ packages = PackageDefinition[]
66+ for r in repos
67+ name = r[" name" ]
68+ name_no_suffix = replace (name, " .jl" => " " )
69+ url = r[" url" ]
70+ homepageUrl = r[" homepageUrl" ]
71+ desc = r[" description" ]
72+
73+ docs = Pair{String, String}[]
74+ if isempty (homepageUrl)
75+ push! (docs, " README" => " https://github.com/JuliaDocs/$name " )
76+ elseif contains (name, " Franklin" ) || contains (name, " PkgPage" )
77+ # special case
78+ push! (docs, " www" => homepageUrl)
79+ else
80+ push! (docs, " stable" => homepageUrl)
81+ push! (docs, " dev" => joinpath (homepageUrl, " dev/" ))
82+ end
83+
84+ branch = r[" defaultBranchRef" ][" name" ]
85+ buildbadges = Pair{String, String}[
86+ " https://codecov.io/gh/JuliaDocs/$name /branch/$branch /graph/badge.svg" =>
87+ " https://codecov.io/gh/JuliaDocs/$name " ,
88+ ]
89+
90+ push! (packages, PackageDefinition (name_no_suffix, url, desc, docs, buildbadges))
91+ end
92+
93+ return package_table_markdown (packages)
94+ end
95+
4296# Build the docs
4397makedocs (
4498 sitename = " JuliaDocs" ,
0 commit comments