ogpy.adapters.sphinx module¶
OGPy Sphinx adapter.
- class ogpy.adapters.sphinx.OGPDomain(env: BuildEnvironment)¶
Bases:
DomainDomain to manage contents metadata.
This has client and cache store.
- property caches: dict[str, Tuple[types.Metadata | types.MetadataFuzzy, int]]¶
Cache storage for OGP metadata.
- directives: dict[str, type[Directive]] = {'figure': <class 'ogpy.adapters.sphinx.OGPFigureDirective'>, 'image': <class 'ogpy.adapters.sphinx.OGPImageDirective'>}¶
directive name -> directive class
- label = 'OGPy Image manageent'¶
domain label: longer, more descriptive (used in messages)
- name = 'ogp'¶
domain name: should be short, but unique
- class ogpy.adapters.sphinx.OGPFigureDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)¶
Bases:
FigureExtended directive for og-image as figure style.
User pass content url as arguments instead of image url. In extension process, it converts from content to image.
- option_spec = {'align': <function Figure.align>, 'alt': <function unchanged>, 'class': <function class_option>, 'figclass': <function class_option>, 'figwidth': <function Figure.figwidth_value>, 'height': <function length_or_unitless>, 'loading': <function Image.loading>, 'name': <function unchanged>, 'scale': <function percentage>, 'width': <function length_or_percentage_or_unitless>}¶
Mapping of option names to validator functions.
- run()¶
- class ogpy.adapters.sphinx.OGPImageDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)¶
Bases:
ImageExtended directive for og-image.
User pass content url as arguments instead of image url. In extension process, it converts from content to image.
- option_spec = {'align': <function Image.align>, 'alt': <function unchanged>, 'class': <function class_option>, 'height': <function length_or_unitless>, 'loading': <function Image.loading>, 'name': <function unchanged>, 'scale': <function percentage>, 'width': <function length_or_percentage_or_unitless>}¶
Mapping of option names to validator functions.
- run()¶
- ogpy.adapters.sphinx.setup(app: Sphinx)¶
Entrypoint as Sphinx-extension.