Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Nora, dreamer quintet
Nora, dreamer quintet
@noracodes@tenforward.social  ·  activity timestamp 5 days ago

The best static site generator is actually just one line of shell and available on any GNU system.

for filename in src/**/*.html; do; cpp -EwP "$filename" > "out/$filename"; done

This works with:
- snippets/shortcodes (e.g. #include "_header.html")
- file metadata (e.g. #define TITLE My Awesome Post)
- conditional inclusion (with #ifdef)

add -finput-charset=utf-8 and -fexec-charset=utf-8 if you'd like to use non-ASCII text.

Enjoy :P

  • Copy link
  • Flag this post
  • Block
Rick Owens
Rick Owens
@rowens@bsd.network replied  ·  activity timestamp 5 days ago

@noracodes
A-yep! Haven't done a full site, but have had great luck with markdown or straight html piped through cpp and/or m4. (Also for markdown -> PDF via Pandoc.)

  • Copy link
  • Flag this comment
  • Block
Jamey Sharp
Jamey Sharp
@jamey@toot.cat replied  ·  activity timestamp 4 days ago

@rowens @noracodes Oh good, I'm glad to see somebody else already suggested m4. I think it's a much better macro language than cpp, just unfairly maligned for having been used to paper over deficiencies in shell scripting for autoconf and in sendmail's configuration language

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct