Skip to content

Commit 6790276

Browse files
committed
Adapting link download
1 parent 34539db commit 6790276

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

doc/source/conf.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
author = "ANSYS, Inc."
2525
release = version = __version__
2626
cname = os.getenv("DOCUMENTATION_CNAME", default="nocname.com")
27+
switcher_version = get_version_match(__version__)
28+
docs_prefix = switcher_version if switcher_version == "dev" else f"release/{switcher_version}"
2729

2830
# Select desired logo, theme, and declare the html title
2931
html_logo = pyansys_logo_black
@@ -40,7 +42,7 @@
4042
html_theme_options = {
4143
"switcher": {
4244
"json_url": f"https://{cname}/release/versions.json",
43-
"version_match": get_version_match(__version__),
45+
"version_match": switcher_version,
4446
},
4547
"navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"],
4648
"github_url": "https://github.com/pyansys/pygeometry",
@@ -167,19 +169,24 @@
167169
168170
.. admonition:: Download this example!
169171
170-
Download this example from this
171-
`link <https://geometry.docs.pyansys.com/{{ env.docname }}.ipynb>`_.
172+
Download this example as a Jupyter Notebook from
173+
`here <{cname_pref}/{ipynb_file_loc}>`_.
174+
175+
""".format(
176+
cname_pref=f"https://{cname}/{docs_prefix}", ipynb_file_loc="{{ env.docname }}.ipynb"
177+
)
172178

173-
"""
174179
nbsphinx_prolog = """
175180
176181
.. admonition:: Download this example!
177182
178-
Download this example from this
179-
`link <https://geometry.docs.pyansys.com/{{ env.docname }}.ipynb>`_.
183+
Download this example as a Jupyter Notebook from
184+
`here <{cname_pref}/{ipynb_file_loc}>`_.
180185
181186
----
182-
"""
187+
""".format(
188+
cname_pref=f"https://{cname}/{docs_prefix}", ipynb_file_loc="{{ env.docname }}.ipynb"
189+
)
183190

184191
typehints_defaults = "comma"
185192
simplify_optional_unions = False

0 commit comments

Comments
 (0)