Add Lua filter for title string

This commit is contained in:
jultty 2024-02-24 15:22:51 -03:00
commit b4c4074e49
4 changed files with 22 additions and 11 deletions

15
posts/filters/title.lua Executable file
View file

@ -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

View file

@ -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

View file

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Scripts em OCaml</title>
<title>Scripts em OCaml • jutty.dev</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
@ -79,9 +79,7 @@
<link rel="stylesheet" href="../../assets/style.css" />
</head>
<body>
<header id="title-block-header">
<h1 class="title">Scripts em OCaml</h1>
</header>
<h1 id="scripts-em-ocaml">Scripts em OCaml</h1>
<p>Este blog gera suas postagens com o Pandoc, mas quem faz o trabalho
lógico de identificar os arquivos e montar os comandos é um pequeno
script em OCaml.</p>

View file

@ -1,6 +1,4 @@
---
title: Scripts em OCaml
---
# Scripts em OCaml
Este blog gera suas postagens com o Pandoc, mas quem faz o trabalho lógico de identificar os arquivos e montar os comandos é um pequeno script em OCaml.