comparison examples/basic/run.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 74cc70129d04
children 1da51d718391
comparison
equal deleted inserted replaced
20:cc92d74ce9e5 21:b4d17897d053
7 7
8 from markup.template import Context, TemplateLoader 8 from markup.template import Context, TemplateLoader
9 9
10 def test(): 10 def test():
11 base_path = os.path.dirname(os.path.abspath(__file__)) 11 base_path = os.path.dirname(os.path.abspath(__file__))
12 loader = TemplateLoader([os.path.join(base_path, 'common'), 12 loader = TemplateLoader([base_path], auto_reload=True)
13 os.path.join(base_path, 'module')],
14 auto_reload=True)
15 13
16 start = datetime.now() 14 start = datetime.now()
17 tmpl = loader.load('test.html') 15 tmpl = loader.load('test.html')
18 print ' --> parse stage: ', datetime.now() - start 16 print ' --> parse stage: ', datetime.now() - start
19 17
Copyright (C) 2012-2017 Edgewall Software