File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/ansys_sphinx_theme/extension Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments