mirror of https://github.com/pyodide/pyodide.git
DOC Fix version warning CSS (#3533)
Close https://github.com/pyodide/pyodide/issues/3513
This commit is contained in:
parent
f943739e8f
commit
71d466df2f
30
docs/conf.py
30
docs/conf.py
|
@ -37,7 +37,6 @@ extensions = [
|
||||||
"autodocsumm",
|
"autodocsumm",
|
||||||
"sphinx_pyodide",
|
"sphinx_pyodide",
|
||||||
"sphinx_argparse_cli",
|
"sphinx_argparse_cli",
|
||||||
"versionwarning.extension",
|
|
||||||
"sphinx_issues",
|
"sphinx_issues",
|
||||||
"sphinx_autodoc_typehints",
|
"sphinx_autodoc_typehints",
|
||||||
"sphinx_design", # Used for tabs in building-from-sources.md
|
"sphinx_design", # Used for tabs in building-from-sources.md
|
||||||
|
@ -51,15 +50,12 @@ jsdoc_config_path = "../src/js/tsconfig.json"
|
||||||
root_for_relative_js_paths = "../src/"
|
root_for_relative_js_paths = "../src/"
|
||||||
issues_github_path = "pyodide/pyodide"
|
issues_github_path = "pyodide/pyodide"
|
||||||
|
|
||||||
versionwarning_messages = {
|
versionwarning_message = (
|
||||||
"latest": (
|
"This is the development version of the documentation. "
|
||||||
"This is the development version of the documentation. "
|
'See <a href="https://pyodide.org/">here</a> for latest stable '
|
||||||
'See <a href="https://pyodide.org/">here</a> for latest stable '
|
"documentation. Please do not use Pyodide with non "
|
||||||
"documentation. Please do not use Pyodide with non "
|
"versioned (`dev`) URLs from the CDN for deployed applications!"
|
||||||
"versioned (`dev`) URLs from the CDN for deployed applications!"
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
versionwarning_body_selector = "#main-content > div"
|
|
||||||
|
|
||||||
autosummary_generate = True
|
autosummary_generate = True
|
||||||
autodoc_default_flags = ["members", "inherited-members"]
|
autodoc_default_flags = ["members", "inherited-members"]
|
||||||
|
@ -105,7 +101,9 @@ html_theme = "sphinx_book_theme"
|
||||||
html_logo = "_static/img/pyodide-logo.png"
|
html_logo = "_static/img/pyodide-logo.png"
|
||||||
|
|
||||||
# theme-specific options
|
# theme-specific options
|
||||||
html_theme_options: dict[str, Any] = {}
|
html_theme_options: dict[str, Any] = {
|
||||||
|
"announcement": "",
|
||||||
|
}
|
||||||
|
|
||||||
# paths that contain custom static files (such as style sheets)
|
# paths that contain custom static files (such as style sheets)
|
||||||
html_static_path = ["_static"]
|
html_static_path = ["_static"]
|
||||||
|
@ -131,6 +129,9 @@ epub_exclude_files = ["search.html"]
|
||||||
|
|
||||||
IN_SPHINX = "sphinx" in sys.modules and hasattr(sys.modules["sphinx"], "application")
|
IN_SPHINX = "sphinx" in sys.modules and hasattr(sys.modules["sphinx"], "application")
|
||||||
IN_READTHEDOCS = "READTHEDOCS" in os.environ
|
IN_READTHEDOCS = "READTHEDOCS" in os.environ
|
||||||
|
IN_READTHEDOCS_LATEST = (
|
||||||
|
IN_READTHEDOCS and os.environ.get("READTHEDOCS_VERSION") == "latest"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
base_dir = Path(__file__).resolve().parent.parent
|
base_dir = Path(__file__).resolve().parent.parent
|
||||||
|
@ -203,6 +204,12 @@ def calculate_pyodide_version(app):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def set_announcement_message():
|
||||||
|
html_theme_options["announcement"] = (
|
||||||
|
versionwarning_message if IN_READTHEDOCS_LATEST else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def write_console_html(app):
|
def write_console_html(app):
|
||||||
# Make console.html file
|
# Make console.html file
|
||||||
env = {"PYODIDE_BASE_URL": app.config.CDN_URL}
|
env = {"PYODIDE_BASE_URL": app.config.CDN_URL}
|
||||||
|
@ -327,6 +334,7 @@ def setup(app):
|
||||||
app.add_config_value("CDN_URL", "", True)
|
app.add_config_value("CDN_URL", "", True)
|
||||||
app.connect("source-read", global_replace)
|
app.connect("source-read", global_replace)
|
||||||
|
|
||||||
|
set_announcement_message()
|
||||||
apply_patches()
|
apply_patches()
|
||||||
calculate_pyodide_version(app)
|
calculate_pyodide_version(app)
|
||||||
ensure_typedoc_on_path()
|
ensure_typedoc_on_path()
|
||||||
|
|
|
@ -7,7 +7,6 @@ sphinx-argparse-cli>=1.6.0
|
||||||
sphinx_book_theme>=0.4.0rc1
|
sphinx_book_theme>=0.4.0rc1
|
||||||
sphinx-issues
|
sphinx-issues
|
||||||
sphinx-js>=3.2.1
|
sphinx-js>=3.2.1
|
||||||
sphinx-version-warning>=1.1.2
|
|
||||||
sphinx-click
|
sphinx-click
|
||||||
sphinx-autodoc-typehints>=1.21.7
|
sphinx-autodoc-typehints>=1.21.7
|
||||||
sphinx-design>=0.3.0
|
sphinx-design>=0.3.0
|
||||||
|
|
Loading…
Reference in New Issue