4/20/2026 at 12:52:55 AM
> "I'll just read a file, swap out some variables, and write some HTML." – Famous last wordsI'm actually living the dream. The key: directly author html. I.e. the above file contains html.
by akkartik
4/20/2026 at 6:30:25 AM
Cool! Also, carrying forward the post author's tongue-in-cheek humour... I see your lua and raise you ~350 lines of Bash (excludes HTML templates). Take a good hard look at this shite [0]. Have you seen anything that is more obviously HTML-about-to-be-expanded-into-a-full-page? shite_template_standard_page_wrapper() {
cat <<EOF
<!DOCTYPE html>
<html lang="en" prefix="og: https://ogp.me/ns#">
$(shite_template_common_head)
<body>
<div id="the-very-top" class="stack center box">
$(cat -)
$(shite_template_common_footer)
</div>
</body>
</html>
EOF
}
And, unlike PHP or whatever... have you ever seen more composable templating, as in functional programming? cat ./sample/hello.html |
shite_template_common_default_page
# Or..
cat ./sample/hello.org |
pandoc -f org -t html |
shite_template_common_default_page
Just imagine all the pipelined pre/post-processor possibilities.[0] project codename `shite`, literally, renders my site https://github.com/adityaathalye/shite
by adityaathalye
4/20/2026 at 12:24:26 PM
How about one line of POSIX sh with cpp? Though it uses the different approach of SSI instead of templating: $ cat <<EOF | sed -E 's/^[\t ]*<!--(#.*)-->$/\1/; t; s/^/\a/' | cpp -traditional -nostdinc -P -C | sed -E 's/^\a//'
<!DOCTYPE html>
<html>
<head><title>My site</title></head>
<body>
<!--#include "navbar.inc.html"-->
<p>Foo</p>
</body>
</html>
EOF
<!DOCTYPE html>
<html>
<head><title>My site</title></head>
<body>
<header>
<a href="/">My cool site</a>
<nav>
<ul>
<li><a href="/blog.html">Blog</a></li>
<li><a href="/about.html">About</a></li>
</ul>
</nav>
</header>
<p>Foo</p>
</body>
</html>
With a little elbow grease, you even get incremental rebuild: https://git.sr.ht/~q3cpma/html-cpp
by a-french-anon