|
1 | 1 | """Sphinx configuration.""" |
2 | 2 |
|
| 3 | +from sphinx.application import Sphinx # type: ignore[import-not-found] |
| 4 | + |
3 | 5 | project = "Odoo Data Flow" |
4 | 6 | author = "bosd" |
5 | 7 | copyright = "2025, bosd" |
|
19 | 21 | # |
20 | 22 | html_logo = "_static/icon.png" |
21 | 23 |
|
| 24 | + |
22 | 25 | # The name of an image file (relative to this directory) to use as a favicon of |
23 | 26 | # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
24 | 27 | # pixels large. |
25 | 28 | html_favicon = "_static/favicon.ico" |
| 29 | +html_static_path = ["_static"] |
| 30 | + |
| 31 | + |
| 32 | +def on_builder_inited(app: Sphinx) -> None: |
| 33 | + """This function is connected to the 'builder-inited' event. |
| 34 | +
|
| 35 | + It removes the sphinx-mermaid extension if the builder is LaTeX, as it is |
| 36 | + not compatible with PDF output. |
| 37 | + """ |
| 38 | + if app.builder.name == "latex": |
| 39 | + if "sphinx_mermaid" in extensions: |
| 40 | + extensions.remove("sphinx_mermaid") |
| 41 | + |
| 42 | + |
| 43 | +# -- Setup function for builder-specific configuration ---------------------- |
| 44 | +def setup(app: Sphinx) -> None: |
| 45 | + """Called by Sphinx during the build process. |
26 | 46 |
|
27 | | -# -- Logic to disable mermaid for LaTeX output ----------------------------- |
28 | | -# The 'tags' object is automatically provided by Sphinx. |
29 | | -tags = globals().get("tags") |
30 | | -if tags and tags.has("latex"): |
31 | | - # The sphinx-mermaid extension is not compatible with the LaTeX builder |
32 | | - extensions.remove("sphinx_mermaid") |
| 47 | + We use this to disable extensions that are not compatible with certain |
| 48 | + builders, like LaTeX/PDF. |
| 49 | + """ |
| 50 | + # The sphinx-mermaid extension is not compatible with the LaTeX builder, |
| 51 | + # so we remove it from the extensions list only when building for PDF. |
| 52 | + app.connect("builder-inited", on_builder_inited) |
0 commit comments