💾 Archived View for midnight.pub › replies › 526 captured on 2022-06-11 at 23:47:36. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

< A little experiment

Parent

~pink2ds

Btw, pandoc has support for templates.

m4_include(website.m4)
m4_define([__title], [])
m4_define([__description], [])
m4_include(article-header.html)
<section>
$body$
</section>
m4_include(footer.html)

(Or you might not even need to use m4 if you used pandoc's templates.)

Write a reply

Replies

~starbreaker wrote (thread):

Thanks, but I've tried pandoc templates for html. I find them better suited for converting novel drafts to Word using a publisher's house style. :) The problem is that if I want to use a different set of <header> and <footer> blocks for my home page vs other pages, or for posts vs pages, that ends up complicating my makefile unless I set variables in my YAML block to control which parts of the template get rendered (since pandoc's include_before and include_after affect what goes before and after <body>. If I stick with m4, I can just include the appropriate headers and footers in individual files and apply a single transform.

Also, I don't want to be too dependent on pandoc. It's a pain in the ass to build on OpenBSD since there isn't a port/package for it. I've just been using pandoc as an example of a markdown converter because I figure it's better-known than other tools. I've been using m4 because it comes with OpenBSD's default install.