summaryrefslogtreecommitdiff
path: root/sphinx/jinja2glue.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-15 15:47:36 +0100
committerGeorg Brandl <georg@python.org>2011-01-15 15:47:36 +0100
commitbb7bf21c7e47b6582b7f74c3d7b97cd684cfe796 (patch)
tree7f285db7ffd46e4eb2c15741a4a725200b7f61a4 /sphinx/jinja2glue.py
parenta63230f12d1f5af6de24a59ba12c17cc8943cdcd (diff)
parente7fa3c6f45f9917d0a3ded691ef01e1da36ce20b (diff)
downloadsphinx-git-bb7bf21c7e47b6582b7f74c3d7b97cd684cfe796.tar.gz
merge with 1.0
Diffstat (limited to 'sphinx/jinja2glue.py')
-rw-r--r--sphinx/jinja2glue.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py
index f9b97e3d8..629bce30f 100644
--- a/sphinx/jinja2glue.py
+++ b/sphinx/jinja2glue.py
@@ -41,6 +41,15 @@ def accesskey(context, key):
return 'accesskey="%s"' % key
return ''
+class idgen(object):
+ def __init__(self):
+ self.id = 0
+ def current(self):
+ return self.id
+ def next(self):
+ self.id += 1
+ return self.id
+
class SphinxFileSystemLoader(FileSystemLoader):
"""
@@ -109,6 +118,7 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
self.environment.filters['toint'] = _toint
self.environment.globals['debug'] = contextfunction(pformat)
self.environment.globals['accesskey'] = contextfunction(accesskey)
+ self.environment.globals['idgen'] = idgen
if use_i18n:
self.environment.install_gettext_translations(
builder.app.translator)