Skip to content

Commit

Permalink
[refactor] Use Sphinx's ExtensionMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ftnext committed Sep 7, 2024
1 parent 1cfa43f commit 1f9f3cb
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/sphinx_new_tab_link/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import TypedDict

from docutils import nodes
from sphinx.application import Sphinx
from sphinx.util.typing import ExtensionMetadata
from sphinxcontrib.kasane import new_translator_class_for_builder

from sphinx_new_tab_link.core import add_icon_to_reference
Expand Down Expand Up @@ -33,11 +32,6 @@ def starttag(self, node: nodes.Node, tagname: str, *args, **atts):
return super().starttag(node, tagname, *args, **atts) # type: ignore[misc] # noqa: E501


class ExtensionMetadata(TypedDict):
version: str
parallel_read_safe: bool


def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value("new_tab_link_show_external_link_icon", False, "html")
app.add_role("icon-link", IconLinkRole())
Expand All @@ -47,4 +41,4 @@ def setup(app: Sphinx) -> ExtensionMetadata:
)
app.connect("builder-inited", html_translator_handler)

return {"version": __VERSION__, "parallel_read_safe": True}
return ExtensionMetadata(version=__VERSION__, parallel_read_safe=True)

0 comments on commit 1f9f3cb

Please sign in to comment.