Better HN
topnewbestaskshowjobs
Log inSign up

ssspaju

1 karma · joined Feb 8, 2019 (7y ago) · 1 submissions

Submissions

comment 7y ago · link · parent

I'd rephrase the question: "Why are we templating YAML with text-based templating tools?"

I and @akx wrote a templating tool called Emrichen that's specifically designed for producing YAML and JSON from YAML templates:

https://github.com/con2/emrichen

In contrast to other template systems, Emrichen templates are not just "based on YAML", they _are_ YAML. YAML tags like "!Var varname" are used to perform things like variable substitution, loops etc. Variables can be of any JSON type, not just strings, and the template is evaluated top–down.