Andriy Kornatskyy avatar Andriy Kornatskyy committed bfd67c3

Added inline_preprocessor to tenjin demo.

Comments (0)

Files changed (4)

demos/template/content/templates-tenjin/shared/master.html

                     <h1><a href="#{path_for('default')}">My Site</a></h1>
                 </div>
                 <div id="logindisplay">
-                    <?py include("shared/snippet/menu-signin.html") ?>
-                    <?py include("shared/snippet/menu-locale.html") ?>
+                    <?py inline("shared/snippet/menu-signin.html") ?>
+                    <?py inline("shared/snippet/menu-locale.html") ?>
                 </div>
                 <div id="menucontainer">
                     <ul id="menu">
                 <div id="footer">Version #{__version__}</div>
             </div>
         </div>
-        <?py include("shared/snippet/script.html") ?>
+        <?py inline("shared/snippet/script.html") ?>
         <?py if not captured_as("script"): ?>
         <?py pass ?>
         <?py #endif ?>

demos/template/development.ini

 auto-reload = False
 inline-preprocessor-fallback = False
 
+[tenjin]
+inline-preprocessor-fallback = False
+
 [uwsgi]
 wsgi = app:main
 #uwsgi-socket = /tmp/uwsgi-test.sock

demos/template/setup.py

 install_requires = [
     'wheezy.core>=0.1.70',
     'wheezy.caching>=0.1.54',
-    'wheezy.html>=0.1.95',
+    'wheezy.html>=0.1.97',
     'wheezy.http>=0.1.236',
     'wheezy.routing>=0.1.124',
     'wheezy.security>=0.1.36',

demos/template/src/config.py

                 whitespace_preprocessor,
             ])
 elif template_engine == 'tenjin':
+    from wheezy.html.ext.tenjin import inline_preprocessor
     from wheezy.html.ext.tenjin import whitespace_preprocessor
     from wheezy.html.ext.tenjin import widget_preprocessor
     from wheezy.html.utils import format_value
     from wheezy.web.templates import TenjinTemplate
 
+    path = ['content/templates-tenjin']
     render_template = TenjinTemplate(
-            path=['content/templates-tenjin'],
+            path=path,
             pp=[
+                inline_preprocessor(path, config.getboolean(
+                    'tenjin', 'inline-preprocessor-fallback')),
                 widget_preprocessor,
                 whitespace_preprocessor,
             ],
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.