Templetize is a script to convert a file or a directory (recursively) to a template for codegen. It is bundled with a simple code generator module to expand these templates.
Project description
Templetize is a script to convert a file or a directory (recursively) to a template for codegen and writes it to stdout.
Codegen uses a single jinja2 template from a given file or string and the data you provide to the code generator to recreate the previously templetized file structure (maybe renaming parts of it).
See the jinja2 documentation for the template syntax.
—
Code generator reads and evaluates templates generated with templetize and creates the directories and files according to the templates instructions.
Bevore operating the template will be parsed thru jinja2.
See the jinja2 documentation for the template syntax.
Code generator special directives start with “@@@” and extend to the end of the line. There are 3 different commands. An example:
@@@ dir dir/to/be/generated/
@@@ file dir/to/be/generated/with-a-file-{{inside}}.txt
This is the content {{inside}} of the file. The word inside will be replaced by jinja2. So if you set ‘inside’: ‘to-generate’, you will get a file called dir/to/be/generated/with-a-file-to-generate.txt with the content This is the content to-generate of the file. […]
@@@ binary another/dir/image.png
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiMgLSotIGNvZGluZzogdXRmLTggLSotCgppbXB==
Code generator will not throw exceptions but just ignore already existing files. They won’t be overwritten. A message is printed to stderr.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.