I use pug to write .json
files (compiled with gulp
, gulp-pug
and gulp-xml2json
).
It works really well normally, but I can't figure out how to get it to handle the asperands (@
) necessary for json-ld
structured data. I've tried every type of interpolation I can think of, including the method suggested by the author for a similar problem (see issue #2783 on github), but haven't had any luck.
Is there a simple solution I'm overlooking?
This works
// data.json.xml.pug
root
context https://json-ld.org/contexts/person.jsonld
compiles to
// data.json
{
"context": "https://json-ld.org/contexts/person.jsonld"
}
This doesn't
// data.json.xml.pug
root
@context https://json-ld.org/contexts/person.jsonld
unexpected text "@cont"
This doesn't either
// data.json.xml.pug
root
#{'@context'} https://json-ld.org/contexts/person.jsonld
Error: Error: Unencoded <
...
Char: @