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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14639 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2010-11-20 01:37:54 +00:00
parent 58eca97e71
commit ec7c49f253
1 changed files with 7 additions and 12 deletions

View File

@ -233,18 +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.items() templatebuiltins = dict([('ttags', [n for ((t,n), (l,a)) in xrefs.items()
templatebuiltins = dict([('ttags', [n for ((t,n),(l,a)) in xrefs if t == 'templatetag' and
if t == 'ttag' and l == 'ref/templates/builtins' ]),
l == 'ref/templates/builtins']), ('tfilters', [n for ((t,n), (l,a)) in xrefs.items()
('tfilters', [n for ((t,n),(l,a)) in xrefs if t == 'templatefilter' and
if t == 'tfilter' and t == 'ref/templates/builtins'])])
l == 'ref/templates/builtins'])])
except AttributeError:
xrefs = self.env.domaindata["std"]["objects"]
templatebuiltins = dict([('ttags', [n for (t,n) in xrefs if t == 'templatetag']),
('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 = ')