Mercurial > genshi > mirror
diff markup/plugin.py @ 21:b4d17897d053 trunk
* Include paths are now interpreted relative to the path of the including template. Closes #3.
* The filename is now included as first item in the `pos` tuple of stream events.
* Simplified the "basic" example so that it actually ''is'' basic.
* Added a more complex example using nested relative includes in [source:/trunk/examples/includes/ examples/includes].
author | cmlenz |
---|---|
date | Tue, 20 Jun 2006 13:05:37 +0000 |
parents | 49364e784c47 |
children | b4f78c05e5c9 |
line wrap: on
line diff
--- a/markup/plugin.py +++ b/markup/plugin.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2006 Mattew Good +# Copyright (C) 2006 Matthew Good # All rights reserved. # # This software is licensed as described in the file COPYING, which @@ -34,18 +34,16 @@ if divider >= 0: package = templatename[:divider] basename = templatename[divider + 1:] + '.html' - fullpath = resource_filename(package, basename) - dirname, templatename = os.path.split(fullpath) - self.loader.search_path.append(dirname) # Kludge + templatename = resource_filename(package, basename) return self.loader.load(templatename) def render(self, info, format='html', fragment=False, template=None): - """Renders the template to a string using the provided info.""" + """Render the template to a string using the provided info.""" return self.transform(info, template).render(method=format) def transform(self, info, template): - "Render the output to Elements" + """Render the output to an event stream.""" if not isinstance(template, Template): template = self.load_template(template)