oembedpy.adapters.sphinx module

Sphinx extension module.

class oembedpy.adapters.sphinx.OembedDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)

Bases: Directive

has_content = False

May the directive have content?

option_spec = {'maxheight': <function positive_int>, 'maxwidth': <function positive_int>}

Mapping of option names to validator functions.

required_arguments = 1

Number of required directive arguments.

run()
class oembedpy.adapters.sphinx.OembedDomain(env: BuildEnvironment)

Bases: Domain

property caches: dict[Tuple[str, int | None, int | None], Content]
has_cache(key: Tuple[str, int | None, int | None]) bool
label = 'oembedpy'

domain label: longer, more descriptive (used in messages)

name = 'oembedpy'

domain name: should be short, but unique

process_doc(env: BuildEnvironment, docname: str, document: nodes.document)

Process a document after it is read by the environment.

resolve_any_xref(env: BuildEnvironment, fromdocname: str, builder: Builder, target: str, node: pending_xref, contnode: nodes.Element) list[tuple[str, nodes.Element]]

Resolve the pending_xref node with the given target.

The reference comes from an “any” or similar role, which means that we don’t know the type. Otherwise, the arguments are the same as for resolve_xref().

The method must return a list (potentially empty) of tuples ('domain:role', newnode), where 'domain:role' is the name of a role that could have created the same reference, e.g. 'py:func'. newnode is what resolve_xref() would return.

Added in version 1.3.

oembedpy.adapters.sphinx.depart_oembed_node(self, node)
class oembedpy.adapters.sphinx.oembed(rawsource='', *children, **attributes)

Bases: General, Element

oembedpy.adapters.sphinx.setup(app: Sphinx)
oembedpy.adapters.sphinx.visit_oembed_node(self, node)