|
1 | 1 | """This is the ansys-sphinx-theme module."""
|
| 2 | +import logging |
2 | 3 | import pathlib
|
3 | 4 | from typing import Any, Dict
|
4 | 5 |
|
|
9 | 10 | from ansys_sphinx_theme.extension.linkcode import DOMAIN_KEYS, sphinx_linkcode_resolve
|
10 | 11 | from ansys_sphinx_theme.latex import generate_404 # noqa: F401
|
11 | 12 |
|
12 |
| -__version__ = "0.10.5" |
| 13 | +__version__ = "0.10.6" |
13 | 14 |
|
14 | 15 | # Declare the fundamental paths of the theme
|
15 | 16 | THIS_PATH = pathlib.Path(__file__).parent.resolve()
|
@@ -158,28 +159,32 @@ def fix_edit_link_page(link: str) -> str:
|
158 | 159 |
|
159 | 160 | if "_autosummary" in pagename:
|
160 | 161 | for obj_node in list(doctree.findall(addnodes.desc)):
|
161 |
| - domain = obj_node.get("domain") |
162 |
| - for signode in obj_node: |
163 |
| - if not isinstance(signode, addnodes.desc_signature): |
164 |
| - continue |
165 |
| - # Convert signode to a specified format |
166 |
| - info = {} |
167 |
| - for key in DOMAIN_KEYS.get(domain, []): |
168 |
| - value = signode.get(key) |
169 |
| - if not value: |
170 |
| - value = "" |
171 |
| - info[key] = value |
172 |
| - if not info: |
173 |
| - continue |
174 |
| - # This is an API example |
175 |
| - return sphinx_linkcode_resolve( |
176 |
| - domain=domain, |
177 |
| - info=info, |
178 |
| - library=f"{github_user}/{github_repo}", |
179 |
| - source_path=github_source, |
180 |
| - github_version=kind, |
181 |
| - edit=True, |
182 |
| - ) |
| 162 | + try: |
| 163 | + domain = obj_node.get("domain") |
| 164 | + for signode in obj_node: |
| 165 | + if not isinstance(signode, addnodes.desc_signature): |
| 166 | + continue |
| 167 | + # Convert signode to a specified format |
| 168 | + info = {} |
| 169 | + for key in DOMAIN_KEYS.get(domain, []): |
| 170 | + value = signode.get(key) |
| 171 | + if not value: |
| 172 | + value = "" |
| 173 | + info[key] = value |
| 174 | + if not info: |
| 175 | + continue |
| 176 | + # This is an API example |
| 177 | + return sphinx_linkcode_resolve( |
| 178 | + domain=domain, |
| 179 | + info=info, |
| 180 | + library=f"{github_user}/{github_repo}", |
| 181 | + source_path=github_source, |
| 182 | + github_version=kind, |
| 183 | + edit=True, |
| 184 | + ) |
| 185 | + except ValueError as e: |
| 186 | + logging.debug(f"An error occurred: {e}") # Log the exception as debug info |
| 187 | + return link |
183 | 188 |
|
184 | 189 | elif "autoapi" in pagename:
|
185 | 190 | for obj_node in list(doctree.findall(addnodes.desc)):
|
|
0 commit comments