From 00616dd0c828db4b55533e0bc78055eae0647765 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Am=C3=A9lia=20Coutard-Sander?= Date: Fri, 19 Sep 2025 19:27:32 +0200 Subject: [PATCH] Portage OCaml --- Makefile | 12 +++--- docs/meta.ml | 24 ++++++++++++ docs/meta.rec | 18 --------- esh.sh | 7 ---- html/atom.xml.esh | 23 ------------ html/atom.xml.ml | 52 ++++++++++++++++++++++++++ html/{index.html.esh => index.html.ml} | 27 ++++++++++--- 7 files changed, 103 insertions(+), 60 deletions(-) create mode 100644 docs/meta.ml delete mode 100644 docs/meta.rec delete mode 100755 esh.sh delete mode 100644 html/atom.xml.esh create mode 100644 html/atom.xml.ml rename html/{index.html.esh => index.html.ml} (87%) diff --git a/Makefile b/Makefile index 207e90f..bf61492 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .PHONY: build clean -ESH=$(patsubst html/%.esh,out/%,$(shell find html -name '*.esh')) -STATIC=$(patsubst html/%,out/%,$(shell find html -type f -and -not -name '*.esh')) -DOCS=$(patsubst %,out/docs/%,$(shell recsel -P file docs/meta.rec)) +ESH=$(patsubst html/%.ml,out/%,$(shell find html -name '*.ml')) +STATIC=$(patsubst html/%,out/%,$(shell find html -type f -and -not -name '*.ml')) +DOCS=$(patsubst %,out/docs/%,$(shell ocaml docs/meta.ml print-doc-files)) build: $(ESH) $(STATIC) $(DOCS) clean: @@ -21,10 +21,10 @@ out/docs/%.otf: docs/%.sfd out/%: html/% mkdir -p "$(@D)" cp "$<" "$@" -out/%: html/%.esh +out/%: html/%.ml mkdir -p "$(@D)" - sh esh.sh < "$<" > "$@" + cd html; ocaml "$*.ml" > "../$@" # Deps -out/index.html out/atom.xml: docs/meta.rec +out/index.html out/atom.xml: docs/meta.ml diff --git a/docs/meta.ml b/docs/meta.ml new file mode 100644 index 0000000..53c14e4 --- /dev/null +++ b/docs/meta.ml @@ -0,0 +1,24 @@ +type doc = { file : string; title : string; date : string } + +let docs = + [ + { + file = "AmyMono-Regular.otf"; + title = "AmyMono Regular"; + date = "2023-11-20"; + }; + { + file = "Little-Nightmares-II-Étude-For-A-Minor.pdf"; + title = "Little Nightmares II - Étude For A Minor"; + date = "2023-07-21"; + }; + { file = "Ma-oz-Tzur.pdf"; title = "Ma'oz Tzur"; date = "2024-06-16" }; + { + file = "The-Owl-House-Outro-Theme.pdf"; + title = "The Owl House - Outro Theme"; + date = "2023-06-14"; + }; + ] + +let () = if Array.length Sys.argv = 2 && Sys.argv.(1) = "print-doc-files" then + List.iter (fun {file; _} -> Printf.printf "%s\n%!" file) docs diff --git a/docs/meta.rec b/docs/meta.rec deleted file mode 100644 index 48fc34b..0000000 --- a/docs/meta.rec +++ /dev/null @@ -1,18 +0,0 @@ -%rec: Doc -%mandatory: file title date - -file: AmyMono-Regular.otf -title: AmyMono Regular -date: 2023-11-20 - -file: Little-Nightmares-II-Étude-For-A-Minor.pdf -title: Little Nightmares II - Étude For A Minor -date: 2023-07-21 - -file: Ma-oz-Tzur.pdf -title: Ma'oz Tzur -date: 2024-06-16 - -file: The-Owl-House-Outro-Theme.pdf -title: The Owl House - Outro Theme -date: 2023-06-14 diff --git a/esh.sh b/esh.sh deleted file mode 100755 index d045f79..0000000 --- a/esh.sh +++ /dev/null @@ -1,7 +0,0 @@ -while read -r line; do - case "$line" in - "#\""*) echo "echo \"$(echo "$line" | sed 's/#"//')\"";; - "#"*) echo "$(echo "$line" | sed "s/#//")";; - *) echo "echo '$(echo "$line" | sed "s/'/'\\\\''/g")'";; - esac -done | sh diff --git a/html/atom.xml.esh b/html/atom.xml.esh deleted file mode 100644 index 99c6e38..0000000 --- a/html/atom.xml.esh +++ /dev/null @@ -1,23 +0,0 @@ - - - - https://ameliathe1st.gay/ - AméliaThe1st - - #" $(recsel -P date docs/meta.rec -S date | tail -n 1)T00:00:00Z - - Amélia Coutard - contact@ameliathe1st.gay - https://ameliathe1st.gay - - - # recsel -P file docs/meta.rec -C -S date | tail -n 10 | while read -r file; do - - #" $(recsel -e "file = \"$file\"" -P title docs/meta.rec) - #" - #" https://ameliathe1st.gay/docs/$(printf '%s' "$file" | jq -Rr @uri) - #" $(recsel -e "file = \"$file\"" -P date docs/meta.rec)T00:00:00Z - - # done - - diff --git a/html/atom.xml.ml b/html/atom.xml.ml new file mode 100644 index 0000000..5f46f20 --- /dev/null +++ b/html/atom.xml.ml @@ -0,0 +1,52 @@ +#use "../docs/meta.ml" +#use "topfind" +#require "netstring" + +let rec take n = function + | [] -> [] + | _ when n = 0 -> [] + | v :: vs -> v :: take (n - 1) vs + +let latest_date = + List.hd + @@ List.sort (fun a b -> compare b a) + @@ List.map (fun { date; _ } -> date) docs + +let entries = + String.concat "" + @@ List.map (fun { title; file; date } -> + Printf.sprintf +{| + %s + + https://ameliathe1st.gay/docs/%s + %sT00:00:00Z + +|} + title + (Netencoding.Url.encode file) + (Netencoding.Url.encode file) + date) + @@ take 10 + @@ List.sort (fun a b -> compare b.date a.date) docs + +let () = + Printf.printf + {| + + + + https://ameliathe1st.gay/ + AméliaThe1st + + %sT00:00:00Z + + Amélia Coutard + contact@ameliathe1st.gay + https://ameliathe1st.gay + + + %s + +|} + latest_date entries diff --git a/html/index.html.esh b/html/index.html.ml similarity index 87% rename from html/index.html.esh rename to html/index.html.ml index 7f64eb8..bb1066f 100644 --- a/html/index.html.esh +++ b/html/index.html.ml @@ -1,4 +1,14 @@ - +#use "../docs/meta.ml" +#use "topfind" +#require "tyxml" +#require "tyxml-ppx" + +open Tyxml + +let () = + Format.printf "%a" (Html.pp ()) + [%html + {| ameliathe1st.gay | Page Principale @@ -8,11 +18,15 @@

Mes dernières publications:

- +

Des liens:

+|}] -- 2.51.0