summaryrefslogtreecommitdiff
path: root/docs/_ext
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2010-12-23 03:01:06 +0000
committerRamiro Morales <cramm0@gmail.com>2010-12-23 03:01:06 +0000
commit47fe010a8e28b08e0273c7b90c29a40e7baf5ed0 (patch)
tree90f2580b1d555014725adbbf313ab9bca7e162f7 /docs/_ext
parent8301a8b9c25fcf086b6f8de878e2833ad357ea04 (diff)
[1.2.X] Rolled back r146331, r14640 (partially) and r14625 so 1.2.X docs are still buildable with Sphinx 0.6.x for the benefit of downstream packagers shipping stable releases of Django.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15030 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/_ext')
-rw-r--r--docs/_ext/djangodocs.py35
1 files changed, 26 insertions, 9 deletions
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
index 24be841110..8c4b51166c 100644
--- a/docs/_ext/djangodocs.py
+++ b/docs/_ext/djangodocs.py
@@ -83,7 +83,10 @@ class VersionDirective(Directive):
if not is_nextversion:
if len(self.arguments) == 1:
linktext = 'Please, see the release notes </releases/%s>' % (arg0)
- xrefs = roles.XRefRole()('doc', linktext, linktext, self.lineno, self.state)
+ try:
+ xrefs = roles.XRefRole()('doc', linktext, linktext, self.lineno, self.state) # Sphinx >= 1.0
+ except AttributeError:
+ xrefs = roles.xfileref_role('doc', linktext, linktext, self.lineno, self.state) # Sphinx < 1.0
node.extend(xrefs[0])
node['version'] = arg0
else:
@@ -193,7 +196,10 @@ def parse_django_admin_node(env, sig, signode):
def parse_django_adminopt_node(env, sig, signode):
"""A copy of sphinx.directives.CmdoptionDesc.parse_signature()"""
- from sphinx.domains.std import option_desc_re
+ try:
+ from sphinx.domains.std import option_desc_re # Sphinx >= 1.0
+ except ImportError:
+ from sphinx.directives.desc import option_desc_re # Sphinx < 1.0
count = 0
firstname = ''
for m in option_desc_re.finditer(sig):
@@ -233,13 +239,24 @@ class DjangoStandaloneHTMLBuilder(StandaloneHTMLBuilder):
self.warn("cannot create templatebuiltins.js due to missing simplejson dependency")
return
self.info(bold("writing templatebuiltins.js..."))
- 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'])])
+ try:
+ # Sphinx < 1.0
+ xrefs = self.env.reftargets.items()
+ templatebuiltins = dict([('ttags', [n for ((t,n),(l,a)) in xrefs
+ if t == 'ttag' and
+ l == 'ref/templates/builtins']),
+ ('tfilters', [n for ((t,n),(l,a)) in xrefs
+ if t == 'tfilter' and
+ l == 'ref/templates/builtins'])])
+ except AttributeError:
+ # Sphinx >= 1.0
+ 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 = ')