diff options
author | blackbird <devnull@localhost> | 2007-05-28 23:31:04 +0200 |
---|---|---|
committer | blackbird <devnull@localhost> | 2007-05-28 23:31:04 +0200 |
commit | ad601c3df3c3e6f3516bc2088bfb5e2ed0e1950e (patch) | |
tree | 3651e7330a4a847fe66f67eb46c2b7642b9afa96 /docs/generate.py | |
parent | 100c4d2b426777dd1198378c45693dacc2c6413a (diff) | |
download | pygments-ad601c3df3c3e6f3516bc2088bfb5e2ed0e1950e.tar.gz |
[svn] added tim hatch's lexer (forgot about the CHANGELOG entry...) and updated docs to jinja 1
Diffstat (limited to 'docs/generate.py')
-rw-r--r-- | docs/generate.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/docs/generate.py b/docs/generate.py index 1ecfeb33..7702cfe5 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -20,7 +20,7 @@ from docutils.parsers.rst import directives from docutils.core import publish_parts from docutils.writers import html4css1 -from jinja import Template, Context, StringLoader +from jinja import from_string from pygments import highlight from pygments.lexers import get_lexer_by_name @@ -151,15 +151,15 @@ TEMPLATE = '''\ <div id="content"> <h1 class="heading">Pygments</h1> <h2 class="subheading">{{ title }}</h2> - {% if not file_id equals "index" %} + {% if file_id != "index" %} <a id="backlink" href="index.html">« Back To Index</a> {% endif %} {% if toc %} <div class="toc"> <h2>Contents</h2> <ul class="contents"> - {% for item in toc %} - <li><a href="{{ item.0 }}">{{ item.1 }}</a></li> + {% for key, value in toc %} + <li><a href="{{ key }}">{{ value }}</a></li> {% endfor %} </ul> </div> @@ -421,13 +421,12 @@ def handle_html(filename, fp, dst): now = datetime.now() title = os.path.basename(filename)[:-4] content = fp.read() - parts = generate_documentation(content, (lambda x: './%s.html' % x)) + c = generate_documentation(content, (lambda x: './%s.html' % x)) result = file(os.path.join(dst, title + '.html'), 'w') - c = Context(parts) c['style'] = STYLESHEET + PYGMENTS_FORMATTER.get_style_defs('.syntax') c['generation_date'] = now c['file_id'] = title - t = Template(TEMPLATE, StringLoader()) + t = from_string(TEMPLATE) result.write(t.render(c).encode('utf-8')) result.close() |