Skip to content

Commit

Permalink
[1.2.X] Fixed hyperlinking of template tags for Sphinx >= 1.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
spookylukey committed Nov 20, 2010
1 parent 84d809d commit 8a0de69
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions docs/_ext/djangodocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,13 @@ def finish(self):
self.warn("cannot create templatebuiltins.js due to missing simplejson dependency")
return
self.info(bold("writing templatebuiltins.js..."))
try:
xrefs = self.env.reftargets.keys()
templatebuiltins = dict([('ttags', [n for (t,n) in xrefs if t == 'ttag']),
('tfilters', [n for (t,n) in xrefs if t == 'tfilter'])])
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'])])
xrefs = self.env.domaindata["std"]["objects"]
templatebuiltins = dict([('ttags', [n for ((t,n), (l,a)) in xrefs.items()
if t == 'templatetag' and
l == 'ref/templates/builtins' ]),
('tfilters', [n for ((t,n), (l,a)) in xrefs.items()
if t == 'templatefilter' and
t == 'ref/templates/builtins'])])
outfilename = os.path.join(self.outdir, "templatebuiltins.js")
f = open(outfilename, 'wb')
f.write('var django_template_builtins = ')
Expand Down

0 comments on commit 8a0de69

Please sign in to comment.