brodul.recipe.template

Buildout recipe for making files out of Jinja2 templates
Download

brodul.recipe.template Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Andraz Brodnik
  • Publisher web site:
  • https://bitbucket.org/niteoweb/

brodul.recipe.template Tags


brodul.recipe.template Description

brodul.recipe.template is a fork of amplecode.recipe.template, a buildout recipe for generating files using Jinja2 templates. The recipe configures a Jinja2 environment, by default relative to the Buildout directory, allowing templates to extend and include other templates relative to the environment.Downloads are available from pypi: http://pypi.python.org/pypi/brodul.recipe.template/Buildout Options- template-file or input (required): One or more Jinja2 template file paths.- target-file or output (required): One of more target file paths. The number of files must match the number of template files.- base-dir: Base directory of the Jinja2 environment. Template file paths are relative to this directory. Default is the Buildout directory.- target-executable: One or more boolean flags (yes|no|true|false|1|0) indicating the executability of the target files. If only one flag is given it is applied to all target files.- eggs: Reserved for a list of eggs, conveniently converted into a pkg_resources.WorkingSet when specified- jinja2_filters: custom filter functions separated by white-spaceAdditional options are simply forwarded to the templates, and options from all the other parts are made available through parts.< part-name >.< option-name > and parts.Lists of ValuesIt is possible for a recipe option to contain one or more values, separated by whitespace. A split filter is available for when you want to iterate over the whitespace separated values in your Jinja2 template:#!/bin/sh{% for cmd in cmds|split %} echo "{{ cmd }}"{% endfor %}Minimal Examplefoo.txt is created from foo.txt.jinja2 without any extra options:parts = foorecipe = brodul.recipe.templatetemplate-file = foo.txt.jinja2target-file = foo.txtLarger Examplefoo.txt is created from myapp/foo.txt.jinja2, bar.sh is created from myapp/bar.sh.jinja2, the second will be executable, and both templates can utilize the additional options specified:parts = foorecipe = brodul.recipe.templatebase-dir = myapptemplate-file = foo.txt.jinja2 bar.sh.jinja2target-file = foo.txt bar.shtarget-executable = false trueproject_name = Another Exampleauthor = MeCustom filtersThe filter function is located in the same directory as the buildout.cfg in a filter.py file. If you want to use more filters separate them with a white space.parts = foorecipe = brodul.recipe.templateinput = foo.txt.jinja2output = foo.txtjinja2_filters = filter.barProduct's homepage


brodul.recipe.template Related Software