@@ -31,6 +31,7 @@ def __init__(self, docstring, config={}):
3131
3232 def load_config (self , config ):
3333 self .use_plots = config .get ('use_plots' , False )
34+ self .use_blockquotes = config .get ('use_blockquotes' , False )
3435 self .class_members_toctree = config .get ('class_members_toctree' , True )
3536 self .template = config .get ('template' , None )
3637 if self .template is None :
@@ -66,18 +67,26 @@ def _str_extended_summary(self):
6667 return self ['Extended Summary' ] + ['' ]
6768
6869 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+
6977 out = []
7078 if self [name ]:
7179 out += self ._str_field_list (name )
7280 out += ['' ]
7381 for param , param_type , desc in self [name ]:
7482 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 )])
7785 else :
78- out += self ._str_indent ([param .strip ()])
86+ out += self ._str_indent ([untyped_fmt % param .strip ()])
7987 if desc :
80- out += ['' ]
88+ if self .use_blockquotes :
89+ out += ['' ]
8190 out += self ._str_indent (desc , 8 )
8291 out += ['' ]
8392 return out
@@ -117,7 +126,7 @@ def _process_param(self, param, desc, fake_autosummary):
117126 relies on Sphinx's plugin mechanism.
118127 """
119128 param = param .strip ()
120- display_param = '**%s**' % param
129+ display_param = ( '**%s**' if self . use_blockquotes else '%s' ) % param
121130
122131 if not fake_autosummary :
123132 return display_param , desc
@@ -192,7 +201,8 @@ def _str_param_list(self, name, fake_autosummary=False):
192201 else :
193202 out += self ._str_indent ([display_param ])
194203 if desc :
195- out += ['' ] # produces a blockquote, rather than a dt/dd
204+ if self .use_blockquotes :
205+ out += ['' ]
196206 out += self ._str_indent (desc , 8 )
197207 out += ['' ]
198208
@@ -262,7 +272,6 @@ def _str_section(self, name):
262272 out = []
263273 if self [name ]:
264274 out += self ._str_header (name )
265- out += ['' ]
266275 content = textwrap .dedent ("\n " .join (self [name ])).split ("\n " )
267276 out += content
268277 out += ['' ]
@@ -281,6 +290,7 @@ def _str_warnings(self):
281290 if self ['Warnings' ]:
282291 out = ['.. warning::' , '' ]
283292 out += self ._str_indent (self ['Warnings' ])
293+ out += ['' ]
284294 return out
285295
286296 def _str_index (self ):
@@ -297,6 +307,7 @@ def _str_index(self):
297307 out += [' single: %s' % (', ' .join (references ))]
298308 else :
299309 out += [' %s: %s' % (section , ',' .join (references ))]
310+ out += ['' ]
300311 return out
301312
302313 def _str_references (self ):
0 commit comments