Repository navigation
Version 0.2.0 - Embedding Extension & Base64 Filter update
Version 0.2.0 - Embedding Extension & Base64 Filter update
Added
- The
EmbedExtensionto the Jinja2 environment used that enables using the
{% embed 'my_file.txt' %}to embed the requested file "as-is" (so not
parsed as a template or anything like that) into templates wholesale with
these optional arguments:indent(default: 0) to indent each line of the embedded file by a certain
number of spaces, e.g. for embedding into YAML files, where indent is
syntactically importantalviss(default:False) to run the embedded file though the Alviss
"render_loader" before embedding the resultsenv(default:False) to make the Alviss parser render${__ENV__:...}
expressionsfidelius(default:False) to make the Alviss parser render
${__FID__:...}expressions
- The main use case here was considered things like creating Kubernetes File
Config maps where e.g. config file content is embedded wholesale into the
manifest's YAML - The
base64filter to the Jinja2 environment used to quicly encode context
variables as base64 encoded strings- The main use case here was considered things like rendering of Kubernetes
Secret manifests where keys need to be base64 encoded
- The main use case here was considered things like rendering of Kubernetes
- A bunch of "proper" unittests for the new embedding and filter functions
Changed
- The
FileTemplatenow uses the Jinja2 environment'sFileSystemLoader,
pre-seeded with search paths of the current working directory (os.getcwd())
as well as the root directory of the script being executed (sys.argv[0])
plus whatever paths are defined in theSTENCIL_TEMPLATE_PATHenvironment
variable, if any (multiple paths seperated by;)