Vars collector and template runner.
Project description
c2c.template
============
Supported template Jinja, Mako, Template.
Tools that collect some vars and get them to a template engine.
Supported template: `Jinja <http://jinja.pocoo.org/>`_,
`Mako <http://www.makotemplates.org/>`_ and
`Template https://pypi-hypernode.com/pypi/z3c.recipe.filetemplate`_.
Use ``c2c-template --help`` to get the command line help.
Vars file
=========
The vars collector gets the vars from YAML files like this one::
extends: inherit.yaml
vars:
string_var: a string
int_var: 42
interpreted_var: __import__('datetime').date.today()
combined_var: 'Today: {interpreted_var:%Y-%m-%d}'
interpreted-vars:
- interpreted_var
The ``inherit.yaml`` is an other file with the same syntax that will provide
initial vars.
The ``vars`` section is where we define the vars values, the YAML files
support typing, than ``42`` will be an integer.
The ``interpreted-vars`` is a list of variable that the value will be
interpreted, than the ``interpreted_var`` will have the value ``4``,
See: `eval() <https://docs.python.org/2/library/functions.html#eval>`_.
The ``combined_var`` reuse a predefined variable and format,
See: `str.format() <https://docs.python.org/2/library/string.html#formatstrings>`_.
============
Supported template Jinja, Mako, Template.
Tools that collect some vars and get them to a template engine.
Supported template: `Jinja <http://jinja.pocoo.org/>`_,
`Mako <http://www.makotemplates.org/>`_ and
`Template https://pypi-hypernode.com/pypi/z3c.recipe.filetemplate`_.
Use ``c2c-template --help`` to get the command line help.
Vars file
=========
The vars collector gets the vars from YAML files like this one::
extends: inherit.yaml
vars:
string_var: a string
int_var: 42
interpreted_var: __import__('datetime').date.today()
combined_var: 'Today: {interpreted_var:%Y-%m-%d}'
interpreted-vars:
- interpreted_var
The ``inherit.yaml`` is an other file with the same syntax that will provide
initial vars.
The ``vars`` section is where we define the vars values, the YAML files
support typing, than ``42`` will be an integer.
The ``interpreted-vars`` is a list of variable that the value will be
interpreted, than the ``interpreted_var`` will have the value ``4``,
See: `eval() <https://docs.python.org/2/library/functions.html#eval>`_.
The ``combined_var`` reuse a predefined variable and format,
See: `str.format() <https://docs.python.org/2/library/string.html#formatstrings>`_.
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.
Source Distribution
c2c.template-0.5.0.tar.gz
(4.1 kB
view details)
File details
Details for the file c2c.template-0.5.0.tar.gz
.
File metadata
- Download URL: c2c.template-0.5.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f92a2e9b30a0856217bc35de146dc97cb51a3f44cecd3e33c5471e32afd986 |
|
MD5 | 9b75bffcb6df20cbbc245da602e3eb12 |
|
BLAKE2b-256 | aa3dd74d3f97aadcae76c29c93b690a7fedf715c987b1405b8e9e408e1b4fb5c |