diff --git a/posts/filters/title.lua b/posts/filters/title.lua new file mode 100755 index 0000000..cc1e735 --- /dev/null +++ b/posts/filters/title.lua @@ -0,0 +1,15 @@ +-- source: https://stackoverflow.com/a/76048743 + +local title + +function Header(e) + if title then return end + title = pandoc.utils.stringify(e) .. " • jutty.dev" +end + +function Meta(e) + if not e.pagetitle then + e.pagetitle = title + return e + end +end diff --git a/posts/gen.ml b/posts/gen.ml index be6dae3..79fc618 100755 --- a/posts/gen.ml +++ b/posts/gen.ml @@ -1,14 +1,14 @@ #!/usr/bin/env utop -let args css = "--css " ^ css ^ " -s --to html5 --highlight-style zenburn " +let args = "--css ../../assets/style.css -s --to html5 " ^ + "--highlight-style zenburn " ^ "--lua-filter filters/title.lua " let vert md = begin Sys.command ( - "pandoc " ^ args "../../assets/style.css" ^ md ^ " -o html/" ^ md ^ ".html " + "pandoc " ^ args ^ " markdown/" ^ md ^ " -o html/" ^ md ^ ".html " ) end ;; -let contents = Sys.readdir "." +let contents = Sys.readdir "./markdown/" |> Array.to_list - |> List.filter (fun e -> e <> "gen.ml" && e <> "html") |> List.map vert diff --git a/posts/html/scripts-em-ocaml.md.html b/posts/html/scripts-em-ocaml.md.html index 0813b9f..b72d4fe 100644 --- a/posts/html/scripts-em-ocaml.md.html +++ b/posts/html/scripts-em-ocaml.md.html @@ -4,7 +4,7 @@ -