|
13 | 13 |
|
14 | 14 | class SphinxDocString(NumpyDocString):
|
15 | 15 | def __init__(self, docstring, config={}):
|
16 |
| - self.use_plots = config.get('use_plots', False) |
| 16 | + # Subclasses seemingly do not call this. |
17 | 17 | NumpyDocString.__init__(self, docstring, config=config)
|
18 | 18 |
|
| 19 | + def load_config(self, config): |
| 20 | + self.use_plots = config.get('use_plots', False) |
| 21 | + self.class_members_toctree = config.get('class_members_toctree', True) |
| 22 | + |
19 | 23 | # string conversion routines
|
20 | 24 | def _str_header(self, name, symbol='`'):
|
21 | 25 | return ['.. rubric:: ' + name, '']
|
@@ -117,8 +121,10 @@ def _str_member_list(self, name):
|
117 | 121 | others.append((param, param_type, desc))
|
118 | 122 |
|
119 | 123 | if autosum:
|
120 |
| - out += ['.. autosummary::', ' :toctree:', ''] |
121 |
| - out += autosum |
| 124 | + out += ['.. autosummary::'] |
| 125 | + if self.class_members_toctree: |
| 126 | + out += [' :toctree:'] |
| 127 | + out += [''] + autosum |
122 | 128 |
|
123 | 129 | if others:
|
124 | 130 | maxlen_0 = max(3, max([len(x[0]) for x in others]))
|
@@ -233,17 +239,18 @@ def __str__(self, indent=0, func_role="obj"):
|
233 | 239 |
|
234 | 240 | class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
|
235 | 241 | def __init__(self, obj, doc=None, config={}):
|
236 |
| - self.use_plots = config.get('use_plots', False) |
| 242 | + self.load_config(config) |
237 | 243 | FunctionDoc.__init__(self, obj, doc=doc, config=config)
|
238 | 244 |
|
239 | 245 | class SphinxClassDoc(SphinxDocString, ClassDoc):
|
240 | 246 | def __init__(self, obj, doc=None, func_doc=None, config={}):
|
241 |
| - self.use_plots = config.get('use_plots', False) |
| 247 | + self.load_config(config) |
242 | 248 | ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config)
|
243 | 249 |
|
244 | 250 | class SphinxObjDoc(SphinxDocString):
|
245 | 251 | def __init__(self, obj, doc=None, config={}):
|
246 | 252 | self._f = obj
|
| 253 | + self.load_config(config) |
247 | 254 | SphinxDocString.__init__(self, doc, config=config)
|
248 | 255 |
|
249 | 256 | def get_doc_object(obj, what=None, doc=None, config={}):
|
|
0 commit comments