4 ms·
Yes, using anylisp as an anything templating engine. I love this stuff. It's not as ideal, but you can even get away with this in Python using comprehensions
by MathMonkeyMan 4y ago
Yes, using anylisp as an anything templating engine. I love this stuff.
It's not as ideal, but you can even get away with this in Python using comprehensions and functions. Any language with nested data structure literals will do. Really, any expression language.
Here's a Python version: https://github.com/dgoffredo/dgoffredo.github.io/blob/master/bin/sxml.py https://github.com/dgoffredo/dgoffredo.github.io/blob/master...
and a Javascript version: https://github.com/dgoffredo/llama/blob/master/llama/xml.js https://github.com/dgoffredo/llama/blob/master/llama/xml.js
...and as others have said, Scheme has "sxml," which I use here: https://github.com/dgoffredo/xsd-gc https://github.com/dgoffredo/xsd-gc
- smitty1e 4y agoFor python, I've used: (1) Triple-quoted strings to set up large markup forms (2) The `%()s` syntax to set up dictionary interpolations (3) Something like: def merge(template, args): return template % args to deliver the goods.