ZC Buildout recipe for creating text files out of templates.
Project description
===============
Textfile Recipe
===============
This is a very simple recipe which generates a textfile
from a template.
The template can be everything, and may contain python-style
string formatters. The values will be replaced with the
options you set inside the buildout.cfg section.
Parameters
==========
template-directory -- the directory to fetch templates from
template -- the template file
default: $(name)s.in
output -- the output file
default: ${buildout:parts-directory}/$(name)s
**${buildout:template-directory}** is set to
**${buildout:directory}/templates** if not set in the buildout section.
Example
=======
An example buildout.cfg::
[buildout]
parts=test.txt
template-directory=${buildout:directory}/templates
[test.txt]
recipe=inquant.recipe.mktemplate
template-directory=${buildout:template-directory}
template=test.txt.in
output=${buildout:directory}/test.txt
avalue=foo
anothervalue=bar
Note that due to the default settings (see above), the **template-directory** and
**template** settings are redundant.
An example text template::
This is just a test
template=%(template)s
output=%(output)s
This is just text %(avalue)s and %(anothervalue)s got
replaced. See?
The recipe will read the template and replace the strings
yielding something like::
This is just a test
template=/Users/seletz/develop/plone/buildout/templates/test.txt.in
output=/Users/seletz/develop/plone/buildout/test.txt
This is just text foo and bar got
replaced. See?
EOF
::
vim: set ft=rst ts=2 sw=2 tw=75 expandtab:
Textfile Recipe
===============
This is a very simple recipe which generates a textfile
from a template.
The template can be everything, and may contain python-style
string formatters. The values will be replaced with the
options you set inside the buildout.cfg section.
Parameters
==========
template-directory -- the directory to fetch templates from
template -- the template file
default: $(name)s.in
output -- the output file
default: ${buildout:parts-directory}/$(name)s
**${buildout:template-directory}** is set to
**${buildout:directory}/templates** if not set in the buildout section.
Example
=======
An example buildout.cfg::
[buildout]
parts=test.txt
template-directory=${buildout:directory}/templates
[test.txt]
recipe=inquant.recipe.mktemplate
template-directory=${buildout:template-directory}
template=test.txt.in
output=${buildout:directory}/test.txt
avalue=foo
anothervalue=bar
Note that due to the default settings (see above), the **template-directory** and
**template** settings are redundant.
An example text template::
This is just a test
template=%(template)s
output=%(output)s
This is just text %(avalue)s and %(anothervalue)s got
replaced. See?
The recipe will read the template and replace the strings
yielding something like::
This is just a test
template=/Users/seletz/develop/plone/buildout/templates/test.txt.in
output=/Users/seletz/develop/plone/buildout/test.txt
This is just text foo and bar got
replaced. See?
EOF
::
vim: set ft=rst ts=2 sw=2 tw=75 expandtab:
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file inquant.recipe.textfile-0.2.2dev_r1970-py2.4.egg
.
File metadata
- Download URL: inquant.recipe.textfile-0.2.2dev_r1970-py2.4.egg
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55db7e32d51e893f1b50d82c382d2ed88413eea6a3ddbc55338aed31a3c9319f |
|
MD5 | b8be8ef0d98f18535fdf532793689f2a |
|
BLAKE2b-256 | ceda76de606fdd149f72259b09a1110ff519fcd236604779c08f1770c50fff98 |