I am using the ‘import’ plugin to work with both json and yaml files.
For json I have used
{{ page.header.imports.ex_config|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_UNESCAPED_SLASHES'))|e('html') }}
This successfully escapes fields in the json file which contain xml data.
How do I achieve the same when importing a yaml file?
I have managed to achieve this using the twig documentation on escaping as at https://twig.symfony.com/doc/2.x/api.html#escaper-extension
Using
{% autoescape 'html' %}
{{ page.header.imports.file1.x|yaml_emit }}
{% endautoescape %}
works for the most part, although I am having difficulty with the processor removing a >-
block chomping indicator
rhuk
3
You might want to post an issue on the plugin’s GItHub repo: https://github.com/Perlkonig/grav-plugin-import
I wanted to but it is a forked repo and he doesn’t seem to have enabled issues