module sphinxext.sphinx_sharenet_extension

Inheritance diagram of pyquickhelper.sphinxext.sphinx_sharenet_extension

Short summary

module pyquickhelper.sphinxext.sphinx_sharenet_extension

Defines a sphinx extension to add button to share a page

source on GitHub

Classes

class

truncated documentation

sharenet_node

Defines sharenet node.

ShareNetDirective

Adds buttons to share a page. It can be done by adding

Functions

function

truncated documentation

depart_sharenet_node

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or …

depart_sharenet_node_html

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or …

depart_sharenet_node_rst

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or …

setup

setup for sharenet (sphinx)

sharenet_role

Defines custom roles sharenet. The following instructions defines buttons of size 20 ( ) …

visit_sharenet_node

what to do when visiting a node sharenet the function should have different behaviour, depending on the format, …

visit_sharenet_node_rst

what to do when visiting a node sharenet the function should have different behaviour, depending on the format, …

Methods

method

truncated documentation

run

Runs the directve.

Documentation

Defines a sphinx extension to add button to share a page

source on GitHub

class pyquickhelper.sphinxext.sphinx_sharenet_extension.ShareNetDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source][source]

Bases: docutils.parsers.rst.Directive

Adds buttons to share a page. It can be done by adding:

.. sharenet::
    :facebook: 1
    :linkedin: 2
    :twitter: 3
    :head: False

Which gives:

The integer indicates the order in which they need to be displayed. It is optional. The option :head: False specifies the javascript part is added to the html body and not the header. The header can be overwritten by other custom commands.

source on GitHub

run()[source][source]

Runs the directve.

Returns

a list of nodes

source on GitHub

sharenet_class[source]

alias of sharenet_node

pyquickhelper.sphinxext.sphinx_sharenet_extension.depart_sharenet_node(self, node)[source][source]

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or the setup should specify a different function for each.

It does only html for the time being.

source on GitHub

pyquickhelper.sphinxext.sphinx_sharenet_extension.depart_sharenet_node_html(self, node)[source][source]

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or the setup should specify a different function for each.

It does only html for the time being.

source on GitHub

pyquickhelper.sphinxext.sphinx_sharenet_extension.depart_sharenet_node_rst(self, node)[source][source]

what to do when leaving a node sharenet the function should have different behaviour, depending on the format, or the setup should specify a different function for each.

source on GitHub

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

setup for sharenet (sphinx)

source on GitHub

class pyquickhelper.sphinxext.sphinx_sharenet_extension.sharenet_node(rawsource='', *children, **attributes)[source][source]

Bases: docutils.nodes.Structural, docutils.nodes.Element

Defines sharenet node.

source on GitHub

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

Defines custom roles sharenet. The following instructions defines buttons of size 20 ( ):

:sharenet:`facebook-linkedin-twitter-20-body`

The last term indicates the javascript part will be included in the HTML body instead of the head as this part might be tweaked by other custom commands.

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_sharenet_extension.visit_sharenet_node(self, node)[source][source]

what to do when visiting a node sharenet the function should have different behaviour, depending on the format, or the setup should specify a different function for each.

source on GitHub

pyquickhelper.sphinxext.sphinx_sharenet_extension.visit_sharenet_node_rst(self, node)[source][source]

what to do when visiting a node sharenet the function should have different behaviour, depending on the format, or the setup should specify a different function for each.

source on GitHub