From 74a46277f845f5053183a506fc1963022fbb2740 Mon Sep 17 00:00:00 2001 From: deesiigneer Date: Tue, 16 Aug 2022 00:12:04 +0300 Subject: [PATCH] version dropdown fix --- docs/_static/custom.css | 8 ++++---- docs/conf.py | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 9c82d71..c70e1f0 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,13 +1,13 @@ /* Background of stable should be green */ -#version_switcher a[data-version-name*="stable"] { +.version-switcher__container a[data-version-name*="stable"] { position: relative; } -#version_switcher a[data-version-name*="stable"] span { +.version-switcher__container a[data-version-name*="stable"] span { color: var(--pst-color-success); } -#version_switcher a[data-version-name*="stable"] span:before { +.version-switcher__container a[data-version-name*="stable"] span:before { content: ""; width: 100%; height: 100%; @@ -16,4 +16,4 @@ top: 0; background-color: var(--pst-color-success); opacity: 0.1; -} +} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index fa02ff1..ddb2343 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,5 @@ from re import search, MULTILINE +import os project = 'pyspapi' copyright = '2022, deesiigneer' @@ -28,6 +29,10 @@ intersphinx_mapping = { 'python': ('https://docs.python.org/3/', None), 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), } + +version_match = os.environ.get("READTHEDOCS_VERSION") +json_url = f"https://pyspapi.readthedocs.io/ru/{version_match}/_static/switcher.json" + intersphinx_disabled_domains = ['std'] language = None locale_dirs = ["locale/"] @@ -67,8 +72,8 @@ html_theme_options = { "show_toc_level": 1, "navbar_start": ["navbar-logo", "version-switcher"], "switcher": { - "json_url": "https://pyspapi.readthedocs.io/en/latest/_static/switcher.json", - "version_match": "latest" + "json_url": json_url, + "version_match": version_match }, "navigation_with_keys": True, }