@@ -31,6 +31,7 @@ def __init__(self, docstring, config={}):
31
31
32
32
def load_config (self , config ):
33
33
self .use_plots = config .get ('use_plots' , False )
34
+ self .use_blockquotes = config .get ('use_blockquotes' , False )
34
35
self .class_members_toctree = config .get ('class_members_toctree' , True )
35
36
self .template = config .get ('template' , None )
36
37
if self .template is None :
@@ -66,18 +67,26 @@ def _str_extended_summary(self):
66
67
return self ['Extended Summary' ] + ['' ]
67
68
68
69
def _str_returns (self , name = 'Returns' ):
70
+ if self .use_blockquotes :
71
+ typed_fmt = '**%s** : %s'
72
+ untyped_fmt = '**%s**'
73
+ else :
74
+ typed_fmt = '%s : %s'
75
+ untyped_fmt = '%s'
76
+
69
77
out = []
70
78
if self [name ]:
71
79
out += self ._str_field_list (name )
72
80
out += ['' ]
73
81
for param , param_type , desc in self [name ]:
74
82
if param_type :
75
- out += self ._str_indent (['**%s** : %s' % (param .strip (),
76
- param_type )])
83
+ out += self ._str_indent ([typed_fmt % (param .strip (),
84
+ param_type )])
77
85
else :
78
- out += self ._str_indent ([param .strip ()])
86
+ out += self ._str_indent ([untyped_fmt % param .strip ()])
79
87
if desc :
80
- out += ['' ]
88
+ if self .use_blockquotes :
89
+ out += ['' ]
81
90
out += self ._str_indent (desc , 8 )
82
91
out += ['' ]
83
92
return out
@@ -117,7 +126,7 @@ def _process_param(self, param, desc, fake_autosummary):
117
126
relies on Sphinx's plugin mechanism.
118
127
"""
119
128
param = param .strip ()
120
- display_param = '**%s**' % param
129
+ display_param = ( '**%s**' if self . use_blockquotes else '%s' ) % param
121
130
122
131
if not fake_autosummary :
123
132
return display_param , desc
@@ -192,7 +201,8 @@ def _str_param_list(self, name, fake_autosummary=False):
192
201
else :
193
202
out += self ._str_indent ([display_param ])
194
203
if desc :
195
- out += ['' ] # produces a blockquote, rather than a dt/dd
204
+ if self .use_blockquotes :
205
+ out += ['' ]
196
206
out += self ._str_indent (desc , 8 )
197
207
out += ['' ]
198
208
@@ -262,7 +272,6 @@ def _str_section(self, name):
262
272
out = []
263
273
if self [name ]:
264
274
out += self ._str_header (name )
265
- out += ['' ]
266
275
content = textwrap .dedent ("\n " .join (self [name ])).split ("\n " )
267
276
out += content
268
277
out += ['' ]
@@ -281,6 +290,7 @@ def _str_warnings(self):
281
290
if self ['Warnings' ]:
282
291
out = ['.. warning::' , '' ]
283
292
out += self ._str_indent (self ['Warnings' ])
293
+ out += ['' ]
284
294
return out
285
295
286
296
def _str_index (self ):
@@ -297,6 +307,7 @@ def _str_index(self):
297
307
out += [' single: %s' % (', ' .join (references ))]
298
308
else :
299
309
out += [' %s: %s' % (section , ',' .join (references ))]
310
+ out += ['' ]
300
311
return out
301
312
302
313
def _str_references (self ):
0 commit comments