Skip to content

Commit

Permalink
Remove call to get_repo_dir()
Browse files Browse the repository at this point in the history
unnecessary
  • Loading branch information
TDKorn committed Apr 7, 2024
1 parent fd60375 commit 4a090a2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions sphinx_github_style/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from pathlib import Path
from typing import Dict, Any
from sphinx.application import Sphinx
from .utils.sphinx import get_conf_val, set_conf_val
from .utils.linkcode import get_linkcode_url, get_linkcode_revision, get_linkcode_resolve

__version__ = "1.2.0"
__author__ = 'Adam Korn <hello@dailykitten.net>'
Expand All @@ -10,10 +12,6 @@
from .github_style import GitHubStyle
from .lexer import GitHubLexer

from .utils.linkcode import get_linkcode_url, get_linkcode_revision, get_linkcode_resolve
from .utils.sphinx import get_conf_val, set_conf_val
from .utils.git import get_repo_dir


def setup(app: Sphinx) -> Dict[str, Any]:
app.setup_extension('sphinx.ext.linkcode')
Expand All @@ -30,14 +28,13 @@ def setup(app: Sphinx) -> Dict[str, Any]:
context=get_conf_val(app, 'html_context'),
)
linkcode_func = get_conf_val(app, "linkcode_resolve")
repo_dir = get_repo_dir()

if not callable(linkcode_func):
print(
"Function `linkcode_resolve` not found in ``conf.py``; "
"using default function from ``sphinx_github_style``"
)
linkcode_func = get_linkcode_resolve(linkcode_url, repo_dir)
linkcode_func = get_linkcode_resolve(linkcode_url)
set_conf_val(app, 'linkcode_resolve', linkcode_func)

app.add_lexer('python', GitHubLexer)
Expand Down

0 comments on commit 4a090a2

Please sign in to comment.