Open trans opened 8 years ago
I can probably do that. Shouldn't take long (assuming there are no complications). What do you want the interface to be? I'm thinking of using a simple heuristic to distinguish YAML vs JSON. Sound okay?
I'm thinking of using a simple heuristic to distinguish YAML vs JSON.
Sounds unstable to me and I feel it will cause bugs.
Here's how I would do it. In case of using stdin
for reading template data, I'd introduce --yaml
flag to indicate that the incoming data is YAML, not JSON. If a -f
flag is used (filename is known), we could just check the file extension (.json
or .yml
or .yaml
). To recap:
$ cat data.yaml | mustached --yaml -t hello.mustache
$ mustached -t hello.mustache -f data.yaml
Okay.
Would be great if it also supported YAML.
P.S. I was just about to write this very utility. Now I don't have to. Yeah!!!!