4 ms·
I've seen m4 for stuff like this in the past, but it always looks so archaic and confusing that I never made it very far. Maybe I just need to force myself thro
by apitman 2y ago
I've seen m4 for stuff like this in the past, but it always looks so archaic and confusing that I never made it very far. Maybe I just need to force myself through a tutorial or something.
The main difference between tuplates and what you're doing is that the tuplates comments remain in the output. Which means you can run tuplates again on the same files and it simply replaces everything between your tuplate_start() and tuplate_end comments. This has a couple nice properties:
1. Your files are always valid code. There's no such thing as a template file that doesn't compile or run.
2. You can commit everything to git
- wonger_ 2y agoAh, great point. That's a nice feature, rerunning on the same file. And it's certainly simpler than m4.
- apitman 2y agoOne one feature is that tuplates.py can update itself since it works with URLs as well. I forgot I have an example from a production site (https://lastlogin.net https://lastlogin.net) if you're interested in seeing it in action: https://github.com/lastlogin-net/lastlogin.net https://github.com/lastlogin-net/lastlogin.net