diff --git a/Project.toml b/Project.toml index e1c61d1..75404d2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,5 +1,6 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" [compat] diff --git a/make.jl b/make.jl index ca5ff41..52eca82 100644 --- a/make.jl +++ b/make.jl @@ -1,10 +1,12 @@ using Documenter using Markdown +using JSON # Types and functions to generate a Markdown table with links to package badges etc. struct PackageDefinition name :: String url :: String + desc :: String docs :: Vector{Pair{String, String}} # type => URL buildbadges :: Vector{Pair{String, String}} # badge => URL end @@ -26,19 +28,71 @@ function markdown(p::PackageDefinition) ) for (image, url) in p.buildbadges ]) + push!(row, Markdown.parse(p.desc)) end function package_table_markdown(packages) - titles = map(["Package", "Documentation", "Coverage"]) do s + titles = map(["Package", "Documentation", "Coverage", "Description"]) do s Markdown.Bold(s) end - table = Markdown.Table([titles], [:l, :c, :c]) + table = Markdown.Table([titles], [:l, :l, :l, :l]) for p in packages push!(table.rows, markdown(p)) end Markdown.MD(table) end +function generate_package_table_markdown() + # query information about all JuliaDocs repositories + data = read(`gh repo list JuliaDocs --json "isArchived,description,homepageUrl,name,url,defaultBranchRef"`, String) + repos = JSON.parse(data) + + # exclude archived repositories + repos = filter!(x -> !x["isArchived"], repos) + + # exclude some other repositories + excluded = [ + "DocumentationGeneratorRegistry", # kinda obsolete + "DocumenterInventoryWritingBackport.jl", + "juliadocs.github.io", # this repository, no point linking to it + "Julia-Cheat-Sheet", # not a package + ] + filter!(x -> x["name"] ∉ excluded, repos) + + # sort alphabetical + sort!(repos, by = x -> x["name"]) + + packages = PackageDefinition[] + for r in repos + name = r["name"] + name_no_suffix = replace(name, ".jl" => "") + url = r["url"] + homepageUrl = r["homepageUrl"] + desc = r["description"] + + docs = Pair{String, String}[] + if isempty(homepageUrl) + push!(docs, "README" => "https://github.com/JuliaDocs/$name") + elseif contains(name, "Franklin") || contains(name, "PkgPage") + # special case + push!(docs, "www" => homepageUrl) + else + push!(docs, "stable" => homepageUrl) + push!(docs, "dev" => joinpath(homepageUrl, "dev/")) + end + + branch = r["defaultBranchRef"]["name"] + buildbadges = Pair{String, String}[ + "https://codecov.io/gh/JuliaDocs/$name/branch/$branch/graph/badge.svg" => + "https://codecov.io/gh/JuliaDocs/$name", + ] + + push!(packages, PackageDefinition(name_no_suffix, url, desc, docs, buildbadges)) + end + + return package_table_markdown(packages) +end + # Build the docs makedocs( sitename = "JuliaDocs", diff --git a/src/index.md b/src/index.md index faf834f..8c2b17f 100644 --- a/src/index.md +++ b/src/index.md @@ -10,76 +10,13 @@ of [Julia programming language](https://julialang.org/) ecosystem. JuliaDocs is the home for the following packages and repositories: -* [Documenter -- Package to combine docstrings with Markdown pages for generating documentation](https://github.com/JuliaDocs/Documenter.jl) -* [DocumenterCitations -- Support for BibTeX citations in Documenter](https://github.com/JuliaDocs/DocumenterCitations.jl) -* [DocumenterMarkdown -- Documenter's Markdown / MkDocs backend](https://github.com/JuliaDocs/DocumenterMarkdown.jl) -* [DocumenterTools -- Extra tools for setting up Documenter](https://github.com/JuliaDocs/DocumenterTools.jl) -* [DocStringExtensions -- Programmatic ways to generate parts of docstrings](https://github.com/JuliaDocs/DocStringExtensions.jl) -* [Highlights -- A code highlighter for the Julia language, written in Julia](https://github.com/JuliaDocs/Highlights.jl) -* [Julia cheat sheet](https://cheatsheet.juliadocs.org/) ([repository](https://github.com/JuliaDocs/Julia-Cheat-Sheet)) - ## Packages ```@eval -import Main: PackageDefinition, package_table_markdown -[ -PackageDefinition( - "Documenter", "https://github.com/JuliaDocs/Documenter.jl", - [ - "stable" => "https://documenter.juliadocs.org/stable/", - "dev" => "https://documenter.juliadocs.org/dev/", - ], - [ - "https://codecov.io/gh/JuliaDocs/Documenter.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/Documenter.jl", - ] -), -PackageDefinition( - "DocumenterCitations", "https://github.com/JuliaDocs/DocumenterCitations.jl", - [ - "stable" => "https://juliadocs.org/DocumenterCitations.jl/stable/", - "dev" => "https://juliadocs.org/DocumenterCitations.jl/dev/", - ], - [ - "https://codecov.io/gh/JuliaDocs/DocumenterCitations.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterCitations.jl", - ] -), -PackageDefinition( - "DocumenterMarkdown", "https://github.com/JuliaDocs/DocumenterMarkdown.jl", - [ - "README" => "https://github.com/JuliaDocs/DocumenterMarkdown.jl#documentermarkdown", - ], - [ - "https://codecov.io/gh/JuliaDocs/DocumenterMarkdown.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterMarkdown.jl", - ] -), -PackageDefinition( - "DocumenterTools", "https://github.com/JuliaDocs/DocumenterTools.jl", - [ - "README" => "https://github.com/JuliaDocs/DocumenterTools.jl#documentertools", - ], - [ - "https://codecov.io/gh/JuliaDocs/DocumenterTools.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocumenterTools.jl", - ] -), -PackageDefinition( - "DocStringExtensions", "https://github.com/JuliaDocs/DocStringExtensions.jl", - [ - "stable" => "https://DocStringExtensions.juliadocs.org/stable/", - "dev" => "https://DocStringExtensions.juliadocs.org/dev/", - ], - [ - "https://codecov.io/gh/JuliaDocs/DocStringExtensions.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/DocStringExtensions.jl", - ] -), -PackageDefinition( - "Highlights", "https://github.com/JuliaDocs/Highlights.jl", - [ - "stable" => "https://Highlights.juliadocs.org/stable/", - "dev" => "https://Highlights.juliadocs.org/dev/", - ], - [ - "https://codecov.io/gh/JuliaDocs/Highlights.jl/branch/master/graph/badge.svg" => "https://codecov.io/gh/JuliaDocs/Highlights.jl", - ] -), -] |> package_table_markdown +import Main: generate_package_table_markdown +generate_package_table_markdown() ``` + +## Other repositories + +* [Julia cheat sheet](https://cheatsheet.juliadocs.org/) ([repository](https://github.com/JuliaDocs/Julia-Cheat-Sheet))