Skip to content

Commit dd8313b

Browse files
maint: update the attributes
1 parent eba20ff commit dd8313b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ansys_sphinx_theme/extension/linkcode.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def link_code(app: Sphinx, doctree: Node):
183183
html_context = getattr(env.config, "html_context", {})
184184
github_user = html_context.get("github_user", "")
185185
github_repo = html_context.get("github_repo", "")
186-
github_source = html_context.get("source_path", "")
186+
source_path = html_context.get("source_path", "")
187187
github_version = html_context.get("github_version", "main")
188188

189189
if getattr(env.config, "link_code_library"):
@@ -195,8 +195,12 @@ def link_code(app: Sphinx, doctree: Node):
195195
else:
196196
raise AttributeError("The library should have either html_context or link_code_library.")
197197

198-
github_source = getattr(env.config, "link_code_source", github_source)
199-
github_version = getattr(env.config, "link_code_branch", github_version)
198+
github_source = (
199+
env.config.link_code_source if getattr(env.config, "link_code_source") else source_path
200+
)
201+
github_version = (
202+
env.config.link_code_branch if getattr(env.config, "link_code_branch") else github_version
203+
)
200204

201205
if not library:
202206
raise AttributeError(

0 commit comments

Comments
 (0)