Skip to content

Commit

Permalink
chore: Add typed remove_tabs_js fix for inline-tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed May 27, 2023
1 parent 58a79ac commit 25e9482
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
import sys
from os.path import dirname, relpath
from pathlib import Path
from typing import Union
import typing as t

import libvcs


if t.TYPE_CHECKING:
from sphinx.application import Sphinx


# Get the project root dir, which is the parent dir of this
doc_path = Path(__file__).parent
project_root = doc_path.parent
Expand Down Expand Up @@ -64,7 +69,7 @@
html_favicon = "_static/favicon.ico"
html_theme = "furo"
html_theme_path: list[str] = []
html_theme_options: dict[str, Union[str, list[dict[str, str]]]] = {
html_theme_options: dict[str, t.Union[str, list[dict[str, str]]]] = {
"light_logo": "img/libvcs.svg",
"dark_logo": "img/libvcs-dark.svg",
"footer_icons": [
Expand Down Expand Up @@ -180,7 +185,7 @@

def linkcode_resolve(
domain: str, info: dict[str, str]
) -> Union[None, str]: # NOQA: C901
) -> t.Union[None, str]: # NOQA: C901
"""
Determine the URL corresponding to Python object
Expand Down Expand Up @@ -252,3 +257,13 @@ def linkcode_resolve(
fn,
linespec,
)


def remove_tabs_js(app: "Sphinx", exc: Exception) -> None:
if app.builder.format == "html" and not exc:
tabs_js = Path(app.builder.outdir) / "_static" / "tabs.js"
tabs_js.unlink()


def setup(app: "Sphinx") -> None:
app.connect("build-finished", remove_tabs_js)

0 comments on commit 25e9482

Please sign in to comment.