Hacker News new | past | comments | ask | show | jobs | submit login

For simple templating I use my own version[1] of pp[2] preprocessor. The idea behind it is ridiculously simple: everything between ^#!$ markers is shell script. Output of the script is pasted verbatim in the document.

[1]: https://github.com/TeddyDD/pp.awk [2]: https://www.mkws.sh/pp.html




That's pretty cool.

I wrote something similar in my static collection of sysadmin tools - https://github.com/skx/sysbox - In my simple pre-processor I only allow two special things:

#include "file/goes/here" #execute ls -l | wc -l

Though there is a more complex version included, which supports all the syntax of the golang text/template library which is more powerful.


Why not just use a shell script and output using cat<<EOF

EOF




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: