Mercurial > hg > MakeItSo
changeset 91:672d2d3ee322
document a bit and add a test for an include example
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 10 Jan 2011 21:42:32 -0800 |
parents | 26b9c3bba04e |
children | bfab7367eb56 |
files | README.txt examples/doctest.txt |
diffstat | 2 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/README.txt Mon Jan 10 21:33:03 2011 -0800 +++ b/README.txt Mon Jan 10 21:42:32 2011 -0800 @@ -13,3 +13,17 @@ And this is the time of the iceberg. If it really is a one-off, who cares? But quickly one-offs become a deployment story, and not a very efficient one. + +Variable Conventions +-------------------- + +MakeItSo! provides a few variables for you. You can include another +file or URL using {{include(URI)}}, where URI is the file path or the +URL (of course, internet is required to include remote resources). The +included resource is not included. + +Files and URLS being interpolated also have the variable %(here)s, +which is the parent of their resource. Therefor, using sensible path +conventions, a neighboring file may be (e.g.) included like + +{{include(here + 'foo.txt')}}
--- a/examples/doctest.txt Mon Jan 10 21:33:03 2011 -0800 +++ b/examples/doctest.txt Mon Jan 10 21:42:32 2011 -0800 @@ -37,6 +37,14 @@ 'Hello fleem' >>> os.remove(buffer) +Including a file:: + + >>> include_example = os.path.join(here, 'include-example.txt') + >>> buffer = tempfile.mktemp() + >>> template = makeitso.PolyTemplate([include_example], interactive=False) + >>> template.substitute({}, buffer) + >>> os.remove(buffer) + Directory case:: >>> exampledir = os.path.join(here, 'directory-example')