Add summary pages for hosted notebooks

This commit is contained in:
Wataru Otsubo 2025-01-26 10:37:42 +01:00
parent 2bab455089
commit d1ff3aed23
10 changed files with 30 additions and 5 deletions

View file

@ -0,0 +1,26 @@
using Markdown
cd("src/notebooks/") do
contents =
map(readdir() |> filter(!=(".gitignore")) |> filter(!=("index.html"))) do file
last_updated = let
cmdout =
read(`git log $file`, String) |>
IOBuffer |>
eachline |>
Iterators.Stateful
@assert popfirst!(cmdout) |> startswith("commit")
@assert popfirst!(cmdout) |> startswith("Author")
dateline = popfirst!(cmdout)
chopprefix(dateline, "Date:") |> strip
end
"- [`$file`]($file) (last updated: $last_updated)"
end |> (v -> join(v, '\n'))
index_content = Markdown.parse("""
# notebooks
$(contents)
""")
open("index.html", "w") do f
show(f, MIME"text/html"(), index_content)
end
end

1
docs/src/notebooks/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
index.html