|
21 | 21 | # import sys
|
22 | 22 | # sys.path.insert(0, os.path.abspath('.'))
|
23 | 23 | import encoding
|
24 |
| -import sphinx_rtd_theme |
| 24 | +import autorch_sphinx_theme |
25 | 25 |
|
26 | 26 |
|
27 | 27 | # -- General configuration ------------------------------------------------
|
|
102 | 102 | # The theme to use for HTML and HTML Help pages. See the documentation for
|
103 | 103 | # a list of builtin themes.
|
104 | 104 | #
|
105 |
| -html_theme = 'sphinx_rtd_theme' |
106 |
| -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
| 105 | +html_theme = 'autorch_sphinx_theme' |
| 106 | +html_theme_path = [autorch_sphinx_theme.get_html_theme_path()] |
107 | 107 |
|
108 | 108 | # Theme options are theme-specific and customize the look and feel of a theme
|
109 | 109 | # further. For a list of options available for each theme, see the
|
|
186 | 186 | author, 'Encoding', 'One line description of project.',
|
187 | 187 | 'Miscellaneous'),
|
188 | 188 | ]
|
189 |
| - |
190 |
| - |
191 |
| -# Example configuration for intersphinx: refer to the Python standard library. |
192 |
| -intersphinx_mapping = { |
193 |
| - 'python': ('https://docs.python.org/', None), |
194 |
| - 'numpy': ('http://docs.scipy.org/doc/numpy/', None), |
195 |
| -} |
196 |
| - |
197 |
| -# -- A patch that prevents Sphinx from cross-referencing ivar tags ------- |
198 |
| -# See http://stackoverflow.com/a/41184353/3343043 |
199 |
| - |
200 |
| -from docutils import nodes |
201 |
| -from sphinx.util.docfields import TypedField |
202 |
| -from sphinx import addnodes |
203 |
| - |
204 |
| - |
205 |
| -def patched_make_field(self, types, domain, items, **kw): |
206 |
| - # `kw` catches `env=None` needed for newer sphinx while maintaining |
207 |
| - # backwards compatibility when passed along further down! |
208 |
| - |
209 |
| - # type: (List, unicode, Tuple) -> nodes.field |
210 |
| - def handle_item(fieldarg, content): |
211 |
| - par = nodes.paragraph() |
212 |
| - par += addnodes.literal_strong('', fieldarg) # Patch: this line added |
213 |
| - # par.extend(self.make_xrefs(self.rolename, domain, fieldarg, |
214 |
| - # addnodes.literal_strong)) |
215 |
| - if fieldarg in types: |
216 |
| - par += nodes.Text(' (') |
217 |
| - # NOTE: using .pop() here to prevent a single type node to be |
218 |
| - # inserted twice into the doctree, which leads to |
219 |
| - # inconsistencies later when references are resolved |
220 |
| - fieldtype = types.pop(fieldarg) |
221 |
| - if len(fieldtype) == 1 and isinstance(fieldtype[0], nodes.Text): |
222 |
| - typename = u''.join(n.astext() for n in fieldtype) |
223 |
| - typename = typename.replace('int', 'python:int') |
224 |
| - typename = typename.replace('long', 'python:long') |
225 |
| - typename = typename.replace('float', 'python:float') |
226 |
| - typename = typename.replace('type', 'python:type') |
227 |
| - par.extend(self.make_xrefs(self.typerolename, domain, typename, |
228 |
| - addnodes.literal_emphasis, **kw)) |
229 |
| - else: |
230 |
| - par += fieldtype |
231 |
| - par += nodes.Text(')') |
232 |
| - par += nodes.Text(' -- ') |
233 |
| - par += content |
234 |
| - return par |
235 |
| - |
236 |
| - fieldname = nodes.field_name('', self.label) |
237 |
| - if len(items) == 1 and self.can_collapse: |
238 |
| - fieldarg, content = items[0] |
239 |
| - bodynode = handle_item(fieldarg, content) |
240 |
| - else: |
241 |
| - bodynode = self.list_type() |
242 |
| - for fieldarg, content in items: |
243 |
| - bodynode += nodes.list_item('', handle_item(fieldarg, content)) |
244 |
| - fieldbody = nodes.field_body('', bodynode) |
245 |
| - return nodes.field('', fieldname, fieldbody) |
246 |
| - |
247 |
| -TypedField.make_field = patched_make_field |
0 commit comments