Skip to content

Commit 1c4facc

Browse files
authored
Enhance make.jl to automatically produce a list of all relevant repositories (#11)
1 parent 0d086b6 commit 1c4facc

File tree

3 files changed

+63
-71
lines changed

3 files changed

+63
-71
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
34
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
45

56
[compat]

make.jl

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using Documenter
22
using Markdown
3+
using JSON
34

45
# Types and functions to generate a Markdown table with links to package badges etc.
56
struct 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
1012
end
@@ -26,19 +28,71 @@ function markdown(p::PackageDefinition)
2628
)
2729
for (image, url) in p.buildbadges
2830
])
31+
push!(row, Markdown.parse(p.desc))
2932
end
3033

3134
function 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)
4043
end
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
4397
makedocs(
4498
sitename = "JuliaDocs",

src/index.md

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,13 @@ of [Julia programming language](https://julialang.org/) ecosystem.
1010

1111
JuliaDocs is the home for the following packages and repositories:
1212

13-
* [Documenter -- Package to combine docstrings with Markdown pages for generating documentation](https://github.com/JuliaDocs/Documenter.jl)
14-
* [DocumenterCitations -- Support for BibTeX citations in Documenter](https://github.com/JuliaDocs/DocumenterCitations.jl)
15-
* [DocumenterMarkdown -- Documenter's Markdown / MkDocs backend](https://github.com/JuliaDocs/DocumenterMarkdown.jl)
16-
* [DocumenterTools -- Extra tools for setting up Documenter](https://github.com/JuliaDocs/DocumenterTools.jl)
17-
* [DocStringExtensions -- Programmatic ways to generate parts of docstrings](https://github.com/JuliaDocs/DocStringExtensions.jl)
18-
* [Highlights -- A code highlighter for the Julia language, written in Julia](https://github.com/JuliaDocs/Highlights.jl)
19-
* [Julia cheat sheet](https://cheatsheet.juliadocs.org/) ([repository](https://github.com/JuliaDocs/Julia-Cheat-Sheet))
20-
2113
## Packages
2214

2315
```@eval
24-
import Main: PackageDefinition, package_table_markdown
25-
[
26-
PackageDefinition(
27-
"Documenter", "https://github.com/JuliaDocs/Documenter.jl",
28-
[
29-
"stable" => "https://documenter.juliadocs.org/stable/",
30-
"dev" => "https://documenter.juliadocs.org/dev/",
31-
],
32-
[
33-
"https://codecov.io/gh/JuliaDocs/Documenter.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/Documenter.jl",
34-
]
35-
),
36-
PackageDefinition(
37-
"DocumenterCitations", "https://github.com/JuliaDocs/DocumenterCitations.jl",
38-
[
39-
"stable" => "https://juliadocs.org/DocumenterCitations.jl/stable/",
40-
"dev" => "https://juliadocs.org/DocumenterCitations.jl/dev/",
41-
],
42-
[
43-
"https://codecov.io/gh/JuliaDocs/DocumenterCitations.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterCitations.jl",
44-
]
45-
),
46-
PackageDefinition(
47-
"DocumenterMarkdown", "https://github.com/JuliaDocs/DocumenterMarkdown.jl",
48-
[
49-
"README" => "https://github.com/JuliaDocs/DocumenterMarkdown.jl#documentermarkdown",
50-
],
51-
[
52-
"https://codecov.io/gh/JuliaDocs/DocumenterMarkdown.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterMarkdown.jl",
53-
]
54-
),
55-
PackageDefinition(
56-
"DocumenterTools", "https://github.com/JuliaDocs/DocumenterTools.jl",
57-
[
58-
"README" => "https://github.com/JuliaDocs/DocumenterTools.jl#documentertools",
59-
],
60-
[
61-
"https://codecov.io/gh/JuliaDocs/DocumenterTools.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterTools.jl",
62-
]
63-
),
64-
PackageDefinition(
65-
"DocStringExtensions", "https://github.com/JuliaDocs/DocStringExtensions.jl",
66-
[
67-
"stable" => "https://DocStringExtensions.juliadocs.org/stable/",
68-
"dev" => "https://DocStringExtensions.juliadocs.org/dev/",
69-
],
70-
[
71-
"https://codecov.io/gh/JuliaDocs/DocStringExtensions.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocStringExtensions.jl",
72-
]
73-
),
74-
PackageDefinition(
75-
"Highlights", "https://github.com/JuliaDocs/Highlights.jl",
76-
[
77-
"stable" => "https://Highlights.juliadocs.org/stable/",
78-
"dev" => "https://Highlights.juliadocs.org/dev/",
79-
],
80-
[
81-
"https://codecov.io/gh/JuliaDocs/Highlights.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/Highlights.jl",
82-
]
83-
),
84-
] |> package_table_markdown
16+
import Main: generate_package_table_markdown
17+
generate_package_table_markdown()
8518
```
19+
20+
## Other repositories
21+
22+
* [Julia cheat sheet](https://cheatsheet.juliadocs.org/) ([repository](https://github.com/JuliaDocs/Julia-Cheat-Sheet))

0 commit comments

Comments
 (0)