if data in self.directives:
node = self.directives[data](lineno, gen)
else:
- raise TemplateSyntaxError('unknown directive %r' % data,
- lineno, self.filename)
+ raise TemplateSyntaxError('unknown directive %r' %
+ str(data), lineno,
+ self.filename)
# some tags like the extends tag do not output nodes.
# so just skip that.
if node is not None:
+++ /dev/null
-<% extends 'layout/base.tmpl' %>
-<% set title = 'Documentation' %>
-<% set active_page = 'documentation' %>
-<% block content %>
- <h1>Documentation</h1>
- <p>
- Currently Jinja 1 in still under heavy development and we have neither
- released a final version nor do we provide a documentation you can download.
- However you can browse the documentation of the current SVN version online:
- </p>
- <p><a href="./documentation/index.html">browse online documentation</a></p>
-<% endblock %>
<ul>
<li>filter functions</li>
<li>block based template inheritance</li>
- <li>the <tt>{% cycle %}</tt> and <tt>{% filter %}</li> tag</li>
+ <li>the <tt>{% cycle %}</tt> and <tt>{% filter %}</tt> tag</li>
<li>being sandboxed</li>
<li>similar default syntax</li>
</ul>
<li>uncoupled internationalization support</li>
<li>expression support in any tag</li>
<li>abbility of modifying the context from the template
- by using the <tt>{% set %}</li> tag.</li>
+ by using the <tt>{% set %}</tt> tag.</li>
<li>support for function calling with arguments</li>
<li>filters can be called with a variable argument count</li>
<li>full unicode support</li>
<li>test functions like <tt>is even</tt> etc.</li>
<li>block delimiters are exchangeable.</il>
<li>no implicit function calling</li>
+ <li><tt>{% endblock %}</tt> doesn't support the optional name argument</li>
+ <li><tt>{% ifchanged %}</tt> is not implemented because of performance
+ reasons. If there's enough interest an implementation might be added</li>
+ <li><tt>{% templatetag %}</tt> is not implemented because Jinja supports
+ escaping via <tt>{% raw %}</tt> or the variable syntax</li>
+ <li><tt>{% comment %}</tt> is not implemented, rather use
+ <tt>{# ... #}</tt> for commenting out stuff.</li>
+ <li><tt>{% now %}</tt> is not implemented because Jinja doesn't handle
+ l10n. Datetime specific stuff should be provided by the application.</li>
+ <li><tt>{% load %}</tt>, loading components for Jinja works from the
+ application side. Template designers don't have to import stuff on
+ their own.</li>
+ <li><tt>{% debug %}</tt> is not implemented. You can use the global
+ function <tt>debug()</tt>.</li>
+ <li>custom tags are not supported. Most of the stuff that is
+ possible with django template tags is possible with either functions,
+ filters, tests or a combination of them.</li>
+ <li>using keywords like <tt>endfor</tt> as identifer raises an
+ exception.</li>
</ul>
<% endblock %>
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
+
_data_re = re.compile(
r'<!-- TITLE -->(?P<page_title>.*?)<!-- ENDTITLE -->.*?'
r'<!-- TOC -->(?P<page_toc>.*?)<!-- ENDTOC -->.*?'
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Frameset//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Untitled | Jinja Template Engine</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" href="./../static/style.css" type="text/css" />
- <link rel="stylesheet" href="./../static/print.css" type="text/css" media="print" />
- <link rel="stylesheet" href="./../static/pygments.css" type="text/css" />
- </head>
- <body>
- <div id="header">
- <h1>Jinja</h1>
- </div>
- <ul id="navigation">
- <li><a href="./../index.html">Index</a></li>
- <li><a href="./../faq.html">FAQ</a></li>
- <li><a href="./../documentation.html">Documentation</a></li>
- <li><a href="./../download.html">Download</a></li>
- </ul>
- <div id="content">
- <div id="contentwrapper">
- </div>
- </div>
- <div id="footer">
- © Copyright 2007 by the Pocoo Team.
- </div>
- </body>
-</html>
\ No newline at end of file
<% set navigation = [
- ('index', 'Index'),
- ('faq', 'FAQ'),
- ('documentation', 'Documentation'),
- ('download', 'Download')
+ ('index.html', 'index', 'Index'),
+ ('faq.html', 'faq', 'FAQ'),
+ ('documentation/index.html', 'documentation', 'Documentation'),
+ ('download.html', 'download', 'Download')
] %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<h1>Jinja</h1>
</div>
<ul id="navigation">
- <% for id, caption in navigation %>
+ <% for href, id, caption in navigation %>
<li<% if id == active_page %> class="active"<% endif
- %>><a href="<%= root %><%= id|escape %>.html"><%= caption|escape
- %></a></li>
+ %>><a href="<%= (root + href)|escape %>"><%= caption|escape %></a></li>
<% endfor %>
</ul>
- <% if trace %>
- <div id="trace">
- <% for href, caption in trace %>
- <% if loop.last %>
- <%= caption %>
- <% else %>
- <a href="<%= href|escape %>"><%= caption %></a> »
- <% endif %>
- <% endfor %>
- </div>
- <% endif %>
<div id="content">
<div id="contentwrapper">
<% block content %><% endblock %>
}
pre {
- background-color: #f9f9f9;
+ background-color: #f8f8f8;
+ color: #000;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
padding: 5px;
}
#header h1 {
- display: none
+ display: none;
}
#navigation {