1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

[1.2.X] Fixed hyperlinking of template tags for Sphinx >= 1.0

Follow on from incomplete fix in [14477], and [14631] which removed
compatibility for Sphinx < 1.0

Backport of [14639] from trunk, and [14477] which was never applied to 1.2.X
branch but should have been.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14640 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2010-11-20 01:56:20 +00:00
parent 84d809d822
commit 8a0de6985c

View File

@ -233,14 +233,13 @@ class DjangoStandaloneHTMLBuilder(StandaloneHTMLBuilder):
self.warn("cannot create templatebuiltins.js due to missing simplejson dependency") self.warn("cannot create templatebuiltins.js due to missing simplejson dependency")
return return
self.info(bold("writing templatebuiltins.js...")) self.info(bold("writing templatebuiltins.js..."))
try: xrefs = self.env.domaindata["std"]["objects"]
xrefs = self.env.reftargets.keys() templatebuiltins = dict([('ttags', [n for ((t,n), (l,a)) in xrefs.items()
templatebuiltins = dict([('ttags', [n for (t,n) in xrefs if t == 'ttag']), if t == 'templatetag' and
('tfilters', [n for (t,n) in xrefs if t == 'tfilter'])]) l == 'ref/templates/builtins' ]),
except AttributeError: ('tfilters', [n for ((t,n), (l,a)) in xrefs.items()
xrefs = self.env.domaindata["std"]["objects"] if t == 'templatefilter' and
templatebuiltins = dict([('ttags', [n for (t,n) in xrefs if t == 'templatetag']), t == 'ref/templates/builtins'])])
('tfilters', [n for (t,n) in xrefs if t == 'templatefilter'])])
outfilename = os.path.join(self.outdir, "templatebuiltins.js") outfilename = os.path.join(self.outdir, "templatebuiltins.js")
f = open(outfilename, 'wb') f = open(outfilename, 'wb')
f.write('var django_template_builtins = ') f.write('var django_template_builtins = ')