From 3ff8622bbc651e64f93d6dc9bd8da9ae1212f516 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Fri, 14 Jan 2022 17:29:30 +0100 Subject: [PATCH 1/2] DOC: add version dropdown to the online doc site --- doc/source/conf.py | 13 +++++++++++++ web/pandas/versions.json | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 web/pandas/versions.json diff --git a/doc/source/conf.py b/doc/source/conf.py index ea878f052f1f8..d35ac8805dad0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -225,11 +225,24 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. + +switcher_version = version +if ".dev" in version: + switcher_version = version.split(".0.dev")[0] + " (dev)" +elif "rc" in version: + switcher_version = version.split("rc")[0] + " (rc)" + html_theme_options = { "external_links": [], "github_url": "https://github.com/pandas-dev/pandas", "twitter_url": "https://twitter.com/pandas_dev", "google_analytics_id": "UA-27880019-2", + "navbar_end": ["version-switcher", "navbar-icon-links"], + "switcher": { + "json_url": "https://pandas.pydata.org/versions.json", + "url_template": "https://pandas.pydata.org/{version}/", + "version_match": switcher_version, + }, } # Add any paths that contain custom themes here, relative to this directory. diff --git a/web/pandas/versions.json b/web/pandas/versions.json new file mode 100644 index 0000000000000..de6c2da71c4ab --- /dev/null +++ b/web/pandas/versions.json @@ -0,0 +1,30 @@ +[ + { + "name": "1.5 (dev)", + "version": "docs/dev" + }, + { + "name": "1.4.0 (rc)", + "version": "pandas-docs/version/1.4" + }, + { + "name": "1.3.5 (stable)", + "version": "docs" + }, + { + "name": "1.3.5", + "version": "pandas-docs/version/1.3" + }, + { + "name": "1.2.5", + "version": "pandas-docs/version/1.2" + }, + { + "name": "1.1.5", + "version": "pandas-docs/version/1.1" + }, + { + "name": "1.0.5", + "version": "pandas-docs/version/1.0" + } +] From 6d3450290aedbca374210bc4b0727c5c19d13905 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 18 Jan 2022 21:52:37 +0100 Subject: [PATCH 2/2] simplify versions + use dev --- doc/source/conf.py | 2 +- web/pandas/versions.json | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index d35ac8805dad0..e8cd85e3369f7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -228,7 +228,7 @@ switcher_version = version if ".dev" in version: - switcher_version = version.split(".0.dev")[0] + " (dev)" + switcher_version = "dev" elif "rc" in version: switcher_version = version.split("rc")[0] + " (rc)" diff --git a/web/pandas/versions.json b/web/pandas/versions.json index de6c2da71c4ab..76c06210e2238 100644 --- a/web/pandas/versions.json +++ b/web/pandas/versions.json @@ -1,30 +1,30 @@ [ { - "name": "1.5 (dev)", + "name": "dev", "version": "docs/dev" }, { - "name": "1.4.0 (rc)", + "name": "1.4 (rc)", "version": "pandas-docs/version/1.4" }, { - "name": "1.3.5 (stable)", + "name": "1.3 (stable)", "version": "docs" }, { - "name": "1.3.5", + "name": "1.3", "version": "pandas-docs/version/1.3" }, { - "name": "1.2.5", + "name": "1.2", "version": "pandas-docs/version/1.2" }, { - "name": "1.1.5", + "name": "1.1", "version": "pandas-docs/version/1.1" }, { - "name": "1.0.5", + "name": "1.0", "version": "pandas-docs/version/1.0" } ]