sphinx_evita

Submodules

Package Contents

Functions

setup

Implementation

init_static_path

Add sphinx_evita/_static to resolve css files, logo etc.

Data

API

sphinx_evita.__version__

‘version(…)’

sphinx_evita.LOGGER: Final[sphinx.util.logging.SphinxLoggerAdapter]

‘getLogger(…)’

sphinx_evita.STATIC_PATH

None

sphinx_evita.setup(app: sphinx.application.Sphinx) dict[str, Any]

Implementation

The main powerhorse of this extension is sphinx_evita.setup(). It does the following:

  1. Connects the sphinx_evita.init_static_path() function to the builder-inited event. This ensures that static files (like CSS or JavaScript) are properly linked when the HTML page loads.

  2. Sets up three sub-extensions:

  3. Checks if the current project is an EVITA project using the sphinx_evita.hooks.is_evita_project() function. If it is, it configures branding and theme settings by connecting the sphinx_evita.hooks.config_branding() and sphinx_evita.hooks.config_theme() functions to the config-inited event. If not, it logs a warning. Which means that certain conf.py values gets overwritten.

Finally it returns a dictionary with metadata about the extension, including its version and flags indicating that it is safe for parallel reading and writing.

Configuration

The extension also declares certain configuration values meant for Sphinx conf.py,

  • evita_pdfembed_html_tag which defaults to "iframe". This means that an <iframe ...></iframe> HTML tag will be used to embed the PDF. Alternative value is "object" tag which embeds using an <object></object>.

  • evita_eu_funding_badge: Add EU badge to the page footer. Supported values are "funded", "co-funded", "" (default, empty string). Original files from sourced from here. In the special case where it is detected to be an EVITA project by sphinx_evita.hooks.is_evita_project(), the badge will be set as "funded" automatically.

sphinx_evita.init_static_path(app: sphinx.application.Sphinx)

Add sphinx_evita/_static to resolve css files, logo etc.