sphinx_gallery.py_source_parser¶
Parser for python source files¶
Functions¶
-
sphinx_gallery.py_source_parser.extract_file_config(content)¶ Pull out the file-specific config specified in the docstring.
-
sphinx_gallery.py_source_parser.get_docstring_and_rest(filename)¶ Separate filename content between docstring and the rest
Strongly inspired from ast.get_docstring.
Returns: - docstring (str) – docstring of filename
- rest (str) – filename content without the docstring
-
sphinx_gallery.py_source_parser.split_code_and_text_blocks(source_file)¶ Return list with source file separated into code and text blocks.
Returns: - file_conf (dict) – File-specific settings given in comments as: # sphinx_gallery_<name> = <value>
- blocks (list of (label, content)) – List where each element is a tuple with the label (‘text’ or ‘code’), and content string of block.