Skip to content

Commit

Permalink
Merge pull request hyperspy#3291 from ericpre/update_version_switcher
Browse files Browse the repository at this point in the history
Update version switcher
  • Loading branch information
jlaehne authored Dec 25, 2023
2 parents 60f27ff + 1812dd7 commit 85cdf6d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
*********

Changelog entries for the development version are available at
https://hyperspy.readthedocs.io/en/latest/user_guide/changes.html
https://hyperspy.readthedocs.io/en/latest/changes.html

.. towncrier-draft-entries:: |release| [UNRELEASED]

Expand Down
10 changes: 7 additions & 3 deletions doc/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[
{
"name": "v2.0 (dev)",
"version": "2.0",
"name": "dev",
"version": "dev",
"url": "https://hyperspy.org/hyperspy-doc/dev/"
},
{
"version": "1.7",
"version": "2.0",
"url": "https://hyperspy.org/hyperspy-doc/current/"
},
{
"version": "1.7",
"url": "https://hyperspy.org/hyperspy-doc/v1.7/"
},
{
"version": "1.6",
"url": "https://hyperspy.org/hyperspy-doc/v1.6/"
Expand Down
11 changes: 10 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@

favicons = ["hyperspy.ico", ]

# For version switcher:
# For development, we match to the dev version in `switcher.json`
# for release version, we match to the minor increment
import hyperspy
_version = hyperspy.__version__
version_match = "dev" if "dev" in _version else ".".join(_version.split(".")[:2])

print("version_match:", version_match)

html_theme_options = {
"show_toc_level": 2,
"github_url": "https://github.com/hyperspy/hyperspy",
Expand Down Expand Up @@ -190,7 +199,7 @@
"switcher": {
# Update when merged and released
"json_url": "https://hyperspy.org/hyperspy-doc/dev/_static/switcher.json",
"version_match": version,
"version_match": version_match,
},
"navbar_start": ["navbar-logo", "version-switcher"],
"announcement": "HyperSpy API is changing in version 2.0, see the <a href='https://hyperspy.org/hyperspy-doc/current/changes.html'>release notes!</a>",
Expand Down
1 change: 1 addition & 0 deletions upcoming_changes/3291.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update version switcher.

0 comments on commit 85cdf6d

Please sign in to comment.