Belle II Software  release-08-01-10
RenderDocstring Class Reference
Inheritance diagram for RenderDocstring:
Collaboration diagram for RenderDocstring:

Public Member Functions

def run (self)
 

Static Public Attributes

bool has_content = True
 
dictionary option_spec
 

Detailed Description

Directive to Render Docstring as Docutils nodes.
This is useful as standard reStructuredText does not parse Google
Docstrings but we support it in docstrings for python functions, modules
and variables. So to show example docstrings in the documentation we don't
want to write the example in Google Docstring and keep that synchronous
with a reStructuredText version

Definition at line 60 of file basf2ext.py.

Member Function Documentation

◆ run()

def run (   self)
Just pass on the content to the autodoc-process-docstring event and
then parse the resulting reStructuredText.

Definition at line 73 of file basf2ext.py.

73  def run(self):
74  """Just pass on the content to the autodoc-process-docstring event and
75  then parse the resulting reStructuredText."""
76  env = self.state.document.settings.env
77  content = list(self.content)
78  try:
79  start_index, end_index = [int(e) for e in self.options.get("lines", None).split(",")]
80  content = content[start_index:end_index]
81  except Exception:
82  pass
83 
84  # remove common whitespace
85  content = textwrap.dedent("\n".join(content)).splitlines()
86 
87  env.app.emit('autodoc-process-docstring', "docstring", None, None, None, content)
88  return parse_with_titles(self.state, content)
89 
90 

Member Data Documentation

◆ option_spec

dictionary option_spec
static
Initial value:
= {
"lines": directives.unchanged
}

Definition at line 69 of file basf2ext.py.


The documentation for this class was generated from the following file: