Utilities¶
Sphinx provides utility classes and functions to develop extensions.
Base classes for components¶
These base classes are useful to allow your extensions to obtain Sphinx
components (e.g. Config
, BuildEnvironment
and so on) easily.
Nota
The subclasses of them might not work with bare docutils because they are strongly coupled with Sphinx.
-
class
sphinx.transforms.
SphinxTransform
(document, startnode=None)[fuente]¶ A base class of Transforms.
Compared with
docutils.transforms.Transform
, this class improves accessibility to Sphinx APIs.The subclasses can access following objects and functions:
- self.app
- The application object (
sphinx.application.Sphinx
) - self.config
- The config object (
sphinx.config.Config
) - self.env
- The environment object (
sphinx.environment.BuildEnvironment
)
-
class
sphinx.transforms.post_transforms.images.
ImageConverter
(*args, **kwargs)[fuente]¶ A base class images converter.
The concrete image converters should derive this class and overrides the following methods and attributes:
- default_priority (if needed)
- conversion_rules
- is_available()
- convert()
-
conversion_rules
= []¶ A conversion rules between two mimetypes which this converters supports