by MathMonkeyMan · 4y ago · 0 comments
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...
and a Javascript version: 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
(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.