Belle II Software development
RenderDocstring Class Reference
Inheritance diagram for RenderDocstring:

Public Member Functions

 run (self)
 

Public Attributes

 state
 

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()

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

Definition at line 75 of file basf2ext.py.

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

Member Data Documentation

◆ state

state

Definition at line 90 of file basf2ext.py.


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