An Alviss and Jinja2 powered template renderer where the context input can be files and entire directory structures can be rendered.
This is a generalized variant of the "CCP Borg Bootstrapper" project bootstrapping and build and deployment tool which used entire "template" projects that were rendered to bootstrap entire projects and to render CI/CD manifests on demand.
The rest of this readme is (at the moment) just a "sketch" for how this package should work and was written before any actual code or functionality.
- No context (Weird use case...?!?)
- kwargs context (via code)
- Dict context (via code)
- Alviss file context (json/yaml + inheritance)
- Args context (from commandline)
- String template (via code)
- File template
- Args template (from commandline)
- Directory template
- String renderer (via code)
- Stdout renderer (for commandline)
- File renderer
- Directory renderer
- ENV var rendering (can be done via ${ENV:FOO} in Alviss input)?
- Meta-data header in files for Directory rendering that controls file names and/or if they should be rendered or not
- Skip-if tag for skipping file rendering
- Some meta-tag that can control the output name of a file via the
FileRenderer
- Meta-data file for directories in Directory rendering that control the directory name?
- Proper Jinja2 Environment Template Loader to enable Jinja's include/extend stuff?
- Custom macros/scripts/filters?
- From commandline (main use case, e.g. rendering CI/CD manifests)
- From code
Using these as a basis for functionality (this is written before any actual code)!
$ ccp-stencil -i context.yaml -t template.html -o result.html
- Alviss file input:
-i context.yaml
- Template file input:
-t template.html
- Render file output:
-o result.html
$ ccp-stencil -a name=Bob -a age=7 -a color=Red -s "My name is {{name}} and I am {{age}} years old and my favorite color is {{color}}"
My name is Bob and I am 7 years old and my favorite color is Red
- Args input:
-a name=Bob -a age=7 -a color=Red
- String template input:
-s "My name is {name} and I am {age} years old and my favorite color is {color}"
- Print (stdout) output: No argument, this is default!
$ ccp-stencil -T templates/ -O build/
- No context input: No argument, this is default!
- Template directory input:
-T templates/
- Render directory output:
-O build/