Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/psf/black
rev: 24.4.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 9.0.0a3
hooks:
- id: isort

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.15.15
hooks:
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v2.1.0
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand Down
16 changes: 4 additions & 12 deletions src/sphinx_tippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ def setup(app: Sphinx):
# or for https://api.datacite.org/dois/
# see https://support.datacite.org/docs/api-get-doi
# and http://schema.datacite.org/meta/kernel-4.4/metadata.xsd
default_doi_template = dedent(
"""\
default_doi_template = dedent("""\
{% set attrs = data.message %}
<div>
<h3>{{ attrs.title[0] }}</h3>
Expand All @@ -71,8 +70,7 @@ def setup(app: Sphinx):
<p><b>Publisher:</b> {{ attrs.publisher }}</p>
<p><b>Published:</b> {{ attrs.created['date-parts'][0] | join('-') }}</p>
</div>
"""
)
""")
app.add_config_value("tippy_doi_template", default_doi_template, "html")
app.add_config_value("tippy_enable_mathjax", False, "html")
app.add_config_value(
Expand Down Expand Up @@ -727,9 +725,7 @@ def write_tippy_props_page(
if tippy_config.tippy_add_class:
tippy_add_class = f"link.classList.add({tippy_config.tippy_add_class!r});"
tippy_props = ", ".join(f"{k}: {v}" for k, v in tippy_config.props.items())
content = (
dedent(
f"""\
content = dedent(f"""\
selector_to_html = {json.dumps(selector_to_html)}
skip_classes = {json.dumps(tippy_config.skip_anchor_classes)}

Expand All @@ -752,11 +748,7 @@ def write_tippy_props_page(
}};
console.log("tippy tips loaded!");
}};
"""
)
if selector_to_html
else ""
)
""") if selector_to_html else ""

data["js_path"].parent.mkdir(parents=True, exist_ok=True)
with data["js_path"].open("w", encoding="utf8") as handle:
Expand Down