diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
a
|
b
|
|
6 | 6 | import docutils.transforms |
7 | 7 | import sphinx |
8 | 8 | import sphinx.addnodes |
9 | | import sphinx.builder |
| 9 | try: |
| 10 | from sphinx import builders |
| 11 | except ImportError: |
| 12 | import sphinx.builder as builders |
10 | 13 | import sphinx.directives |
11 | 14 | import sphinx.environment |
12 | | import sphinx.htmlwriter |
| 15 | try: |
| 16 | import sphinx.writers.html as sphinx_htmlwriter |
| 17 | except ImportError: |
| 18 | import sphinx.htmlwriter as sphinx_htmlwriter |
13 | 19 | import sphinx.roles |
14 | 20 | from docutils import nodes |
15 | 21 | |
… |
… |
|
44 | 50 | directivename = "django-admin-option", |
45 | 51 | rolename = "djadminopt", |
46 | 52 | indextemplate = "pair: %s; django-admin command-line option", |
47 | | parse_node = lambda env, sig, signode: sphinx.directives.parse_option_desc(signode, sig), |
| 53 | parse_node = parse_django_adminopt_node, |
48 | 54 | ) |
49 | 55 | app.add_config_value('django_next_version', '0.0', True) |
50 | 56 | app.add_directive('versionadded', parse_version_directive, 1, (1, 1, 1)) |
… |
… |
|
102 | 108 | if len(node.children) == 1 and isinstance(node.children[0], self.suppress_blockquote_child_nodes): |
103 | 109 | node.replace_self(node.children[0]) |
104 | 110 | |
105 | | class DjangoHTMLTranslator(sphinx.htmlwriter.SmartyPantsHTMLTranslator): |
| 111 | class DjangoHTMLTranslator(sphinx_htmlwriter.SmartyPantsHTMLTranslator): |
106 | 112 | """ |
107 | 113 | Django-specific reST to HTML tweaks. |
108 | 114 | """ |
… |
… |
|
125 | 131 | # |
126 | 132 | def visit_literal_block(self, node): |
127 | 133 | self.no_smarty += 1 |
128 | | sphinx.htmlwriter.SmartyPantsHTMLTranslator.visit_literal_block(self, node) |
129 | | |
| 134 | sphinx_htmlwriter.SmartyPantsHTMLTranslator.visit_literal_block(self, node) |
| 135 | |
130 | 136 | def depart_literal_block(self, node): |
131 | | sphinx.htmlwriter.SmartyPantsHTMLTranslator.depart_literal_block(self, node) |
| 137 | sphinx_htmlwriter.SmartyPantsHTMLTranslator.depart_literal_block(self, node) |
132 | 138 | self.no_smarty -= 1 |
133 | 139 | |
134 | 140 | # |
… |
… |
|
162 | 168 | # Give each section a unique ID -- nice for custom CSS hooks |
163 | 169 | # This is different on docutils 0.5 vs. 0.4... |
164 | 170 | |
165 | | if hasattr(sphinx.htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title') and sphinx.__version__ == '0.4.2': |
| 171 | if hasattr(sphinx_htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title') and sphinx.__version__ == '0.4.2': |
166 | 172 | def start_tag_with_title(self, node, tagname, **atts): |
167 | 173 | node = { |
168 | 174 | 'classes': node.get('classes', []), |
… |
… |
|
176 | 182 | node['ids'] = ['s-' + i for i in old_ids] |
177 | 183 | if sphinx.__version__ != '0.4.2': |
178 | 184 | node['ids'].extend(old_ids) |
179 | | sphinx.htmlwriter.SmartyPantsHTMLTranslator.visit_section(self, node) |
| 185 | sphinx_htmlwriter.SmartyPantsHTMLTranslator.visit_section(self, node) |
180 | 186 | node['ids'] = old_ids |
181 | 187 | |
182 | 188 | def parse_django_admin_node(env, sig, signode): |
… |
… |
|
186 | 192 | signode += sphinx.addnodes.desc_name(title, title) |
187 | 193 | return sig |
188 | 194 | |
| 195 | def parse_django_adminopt_node(env, sig, signode): |
| 196 | """A copy of sphinx.directives.CmdoptionDesc.parse_signature()""" |
| 197 | from sphinx import addnodes |
| 198 | from sphinx.directives.desc import option_desc_re |
| 199 | count = 0 |
| 200 | firstname = '' |
| 201 | for m in option_desc_re.finditer(sig): |
| 202 | optname, args = m.groups() |
| 203 | if count: |
| 204 | signode += addnodes.desc_addname(', ', ', ') |
| 205 | signode += addnodes.desc_name(optname, optname) |
| 206 | signode += addnodes.desc_addname(args, args) |
| 207 | if not count: |
| 208 | firstname = optname |
| 209 | count += 1 |
| 210 | if not firstname: |
| 211 | raise ValueError |
| 212 | return firstname |
| 213 | |
189 | 214 | def monkeypatch_pickle_builder(): |
190 | 215 | import shutil |
191 | 216 | from os import path |
… |
… |
|
214 | 239 | |
215 | 240 | # copy the environment file from the doctree dir to the output dir |
216 | 241 | # as needed by the web app |
217 | | shutil.copyfile(path.join(self.doctreedir, sphinx.builder.ENV_PICKLE_FILENAME), |
218 | | path.join(self.outdir, sphinx.builder.ENV_PICKLE_FILENAME)) |
| 242 | shutil.copyfile(path.join(self.doctreedir, builders.ENV_PICKLE_FILENAME), |
| 243 | path.join(self.outdir, builders.ENV_PICKLE_FILENAME)) |
219 | 244 | |
220 | 245 | # touch 'last build' file, used by the web application to determine |
221 | 246 | # when to reload its environment and clear the cache |
222 | | open(path.join(self.outdir, sphinx.builder.LAST_BUILD_FILENAME), 'w').close() |
| 247 | open(path.join(self.outdir, builders.LAST_BUILD_FILENAME), 'w').close() |
223 | 248 | |
224 | | sphinx.builder.PickleHTMLBuilder.handle_finish = handle_finish |
225 | | |
| 249 | builders.PickleHTMLBuilder.handle_finish = handle_finish |
| 250 | |
diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html
a
|
b
|
|
1 | 1 | {% extends "!layout.html" %} |
2 | 2 | |
3 | | {%- macro secondnav %} |
| 3 | {%- macro secondnav() %} |
4 | 4 | {%- if prev %} |
5 | 5 | « <a href="{{ prev.link|e }}" title="{{ prev.title|e }}">previous</a> |
6 | 6 | {{ reldelim2 }} |