Provide a ‘DocHelperWriter’ class to generate the Sphinx complient documentation of a module.
-
class
pysphinxdoc.docgen.
DocHelperWriter
(path_module, outdir, module_names, root_module_name, generate_examples=False, rst_extension='.rst', verbose=0)[source]¶ A basic class to create the Sphinx complient documentation of a module.
-
format_with_dict
(string, dictionary)[source]¶ Use regular expressions to replace % by %% where % is not followed by (. Avoid “not enough arguments for format string” errors.
Parameters: string : str
a string to be formated.
dictionary : dict
a mapping used to edit the input string.
-
generate_documentation_index_entry
(module_name, indent=4)[source]¶ Generate a new entry in the dicumentation index.
Parameters: module_name: string
the name of the module we want to index.
ident: int
the number of blank prefix.
Returns: ad : string
the reST formated index description.
-
mandatory_fields
= {'AUTHOR_EMAIL': 'the author e-mail', '__version__': 'the module version', 'NAME': 'the name of the module', 'AUTHOR': 'the author of the module', 'URL': 'the module URL', 'SUMMARY': 'a summary displayed with the carousel', 'LONG_DESCRIPTION': 'the index page content', 'DESCRIPTION': 'the module short description that will be displayed in the banner'}¶
-
optional_fields
= {'EXTRAURL': 'the associated URL (default the pySphinxDoc URL)', 'EXTRANAME': "a name that will be displayed in the last element of the navbar (default 'PYSPHINXDOC')"}¶
-
rst2html
(rst, indent=4)[source]¶ Convert a reST formated string to a HTML string.
Parameters: rst: str (mandatory)
the rst formated string.
ident: int
the number of blank prefix.
Returns: out: str
the html formated string.
-
title_for
(title)[source]¶ Create a title from a underscore-separated string.
Parameters: title: str (mandatory)
the string to format.
Returns: out: str
the formated string.
-
write_api_docs
(indent=4)[source]¶ Generate API reST files.
Parameters: indent: int
The number of blank prefix.
-
write_from_template
(out_file, template_file, template_info)[source]¶ Edit/save a template file.
Parameters: out_file : str
the location where the edited template file content is written.
template_file : str
the location of the template file.
template_info : dict
a mapping used to edit the template content.
-