module sphinxext.sphinx_epkg_extension

Inheritance diagram of pyquickhelper.sphinxext.sphinx_epkg_extension

Short summary

module pyquickhelper.sphinxext.sphinx_epkg_extension

Defines a way to reference a package or a page in this package.

source on GitHub

Classes

class

truncated documentation

ClassStruct

Class as struct.

epkg_node

Defines epkg node.

Functions

function

truncated documentation

depart_epkg_node

What to do when leaving a node epkg.

epkg_role

Defines custom role epkg. A list of supported urls must be defined in the configuration file. It wants to replace …

setup

setup for bigger (sphinx)

visit_epkg_node

What to do when visiting a node epkg.

Methods

method

truncated documentation

__init__

All arguments are added to the class.

Documentation

Defines a way to reference a package or a page in this package.

source on GitHub

class pyquickhelper.sphinxext.sphinx_epkg_extension.ClassStruct(**kwargs)[source][source]

Bases: object

Class as struct.

source on GitHub

All arguments are added to the class.

source on GitHub

__init__(**kwargs)[source][source]

All arguments are added to the class.

source on GitHub

pyquickhelper.sphinxext.sphinx_epkg_extension.depart_epkg_node(self, node)[source][source]

What to do when leaving a node epkg.

source on GitHub

class pyquickhelper.sphinxext.sphinx_epkg_extension.epkg_node(rawsource='', text='', *children, **attributes)[source][source]

Bases: docutils.nodes.TextElement

Defines epkg node.

source on GitHub

__slotnames__ = [][source]
pyquickhelper.sphinxext.sphinx_epkg_extension.epkg_role(role, rawtext, text, lineno, inliner, options=None, content=None)[source][source]

Defines custom role epkg. A list of supported urls must be defined in the configuration file. It wants to replace something like:

`to_html <http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_html.html>`_

By:

:epkg:`pandas:DataFrame.to_html`

It inserts in the configuration the variable:

epkg_dictionary = {'pandas': ('http://pandas.pydata.org/pandas-docs/stable/generated/',
                              ('http://pandas.pydata.org/pandas-docs/stable/generated/{0}.html', 1))
                                                                            # 1 for one paraemter
                    '*py': ('https://docs.python.org/3/',
                            ('https://docs.python.org/3/library/{0}.html#{0}.{1}', 2))
                   }

If the module name starts with a ‘*’, the anchor does not contain it. See also epkg: cache references. If no template is found, the role will look into the list of options to see if there is one function. It must be the last one.

def my_custom_links(input):
    return "string to display", "url"

epkg_dictionary = {'weird_package': ('http://pandas.pydata.org/pandas-docs/stable/generated/',
                              ('http://pandas.pydata.org/pandas-docs/stable/generated/{0}.html', 1),
                              my_custom_links)

However, it is impossible to use a function as a value in the configuration because pickle does not handle this scenario (see PicklingError on environment when config option value is a callable), my_custom_links needs to be replaced by: ("module_where_it_is_defined.function_name", None). The role epkg will import it based on its name.

Parameters
  • role – The role name used in the document.

  • rawtext – The entire markup snippet, with role.

  • text – The text marked with the role.

  • lineno – The line number where rawtext appears in the input.

  • inliner – The inliner instance that called us.

  • options – Directive options for customization.

  • content – The directive content for customization.

source on GitHub

pyquickhelper.sphinxext.sphinx_epkg_extension.setup(app)[source][source]

setup for bigger (sphinx)

source on GitHub

pyquickhelper.sphinxext.sphinx_epkg_extension.visit_epkg_node(self, node)[source][source]

What to do when visiting a node epkg.

source on GitHub