From 723785c96efca714faff027d7c5e6451b4c37c1d Mon Sep 17 00:00:00 2001 From: curious-turtle Date: Fri, 31 Jul 2026 23:28:32 +0530 Subject: [PATCH] docs(sphinx): Theme change to pydata-sphinx-theme Changed the Sphinx theme from "sphinx_rtd_theme" to "pydata_sphinx_theme" to remain consistent with the other S-CORE sites. --- .github/workflows/deploy_docs.yml | 18 +- MODULE.bazel | 8 + bazel/rules/rules_score/BUILD | 30 +- bazel/rules/rules_score/docs/development.rst | 23 ++ bazel/rules/rules_score/docs/index.rst | 49 ++- bazel/rules/rules_score/docs/overview.rst | 5 + .../rules/rules_score/docs/qualification.rst | 23 ++ bazel/rules/rules_score/docs/usage.rst | 23 ++ bazel/rules/rules_score/docs/validation.rst | 26 ++ .../templates/conf.score_layout.template.py | 307 ++++++++++++++++++ docs/_static/css/version_flyout.css | 138 -------- docs/_static/js/version_flyout.js | 102 ------ 12 files changed, 472 insertions(+), 280 deletions(-) create mode 100644 bazel/rules/rules_score/docs/development.rst create mode 100644 bazel/rules/rules_score/docs/qualification.rst create mode 100644 bazel/rules/rules_score/docs/usage.rst create mode 100644 bazel/rules/rules_score/docs/validation.rst create mode 100644 bazel/rules/rules_score/templates/conf.score_layout.template.py delete mode 100644 docs/_static/css/version_flyout.css delete mode 100644 docs/_static/js/version_flyout.js diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 8c305388..a352d135 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -96,13 +96,6 @@ jobs: # Prevent Jekyll from ignoring _static directories touch docs_output/.nojekyll - - # Inject version flyout CSS and JS into all HTML files - REPO_NAME="${{ github.event.repository.name }}" - find docs_output -name '*.html' -exec sed -i \ - -e "s||\n|" \ - -e "s||\n|" \ - {} + - name: Verify build output run: | if [[ ! -f docs_output/index.html ]]; then @@ -192,16 +185,13 @@ jobs: fi fi - # --- shared assets --- - mkdir -p publish/_shared/css publish/_shared/js - cp docs/_static/css/version_flyout.css publish/_shared/css/ - cp docs/_static/js/version_flyout.js publish/_shared/js/ - # --- root index & Jekyll bypass --- cp docs/_gh_pages/index.html publish/index.html touch publish/.nojekyll - # --- generate switcher.json --- + # --- generate versions.json (consumed by the score_layout built-in + # navbar version switcher via json_url = + # https://.github.io//versions.json) --- { echo '[' echo " {\"name\": \"latest\", \"version\": \"latest\", \"url\": \"${REPO_URL}/latest/\"}" @@ -216,7 +206,7 @@ jobs: done echo ']' - } > publish/switcher.json + } > publish/versions.json - name: Upload Pages artifact if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index 9cbb87df..4ae9d0fe 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -41,6 +41,9 @@ bazel_dep(name = "flatbuffers", version = "25.9.23") bazel_dep(name = "download_utils", version = "1.2.2") bazel_dep(name = "trlc", version = "3.0.0") bazel_dep(name = "lobster", version = "1.0.4") + +bazel_dep(name = "score_docs_as_code", version = "4.6.1", dev_dependency = True) + bazel_dep(name = "rules_distroless", version = "0.8.0") bazel_dep(name = "googletest", version = "1.17.0.bcr.2") @@ -322,6 +325,11 @@ apt.install( ) use_repo(apt, "docs_runtime") +register_toolchains( + "//bazel/rules/rules_score:sphinx_score_layout_toolchain", + dev_dependency = True, +) + register_toolchains( "//bazel/rules/rules_score:sphinx_default_toolchain", ) diff --git a/bazel/rules/rules_score/BUILD b/bazel/rules/rules_score/BUILD index 8fa9a1b5..fb026331 100644 --- a/bazel/rules/rules_score/BUILD +++ b/bazel/rules/rules_score/BUILD @@ -19,7 +19,11 @@ load( "//bazel/rules/rules_score:rules_score.bzl", "sphinx_module", ) -load("//bazel/rules/rules_score:sphinx_toolchain.bzl", "sphinx_toolchain") +load( + "//bazel/rules/rules_score:sphinx_toolchain.bzl", + "score_sphinx_toolchain", + "sphinx_toolchain", +) load("//lobster_bazel:lobster_bazel.bzl", "lobster_linker") config_setting( @@ -34,6 +38,7 @@ exports_files([ "src/bazel_sphinx_needs.py", "src/sphinx_wrapper.py", "templates/conf.template.py", + "templates/conf.score_layout.template.py", "templates/dependable_element_index.template.rst", "templates/section_page.template.rst", "templates/unit.template.rst", @@ -293,6 +298,29 @@ toolchain( toolchain_type = ":toolchain_type", ) +# Scoped Sphinx toolchain that renders with the shared S-CORE layout +# (score_layout extension from score_docs_as_code) instead of the stock +# Read-the-Docs theme, so this repository's own documentation site matches the +# baselibs / lifecycle sites (top navigation bar instead of the RTD expandable +# left sidebar). Registered ahead of :sphinx_default_toolchain in the root +# MODULE.bazel so it wins toolchain resolution for this module's sphinx_module +# targets, while downstream consumers keep the default RTD toolchain. +score_sphinx_toolchain( + name = "sphinx_score_layout_toolchain", + conf_template = "//bazel/rules/rules_score:templates/conf.score_layout.template.py", + extra_deps = [ + # score_layout provides the shared S-CORE theme (top navigation). We + # deliberately depend on it directly rather than on score_sphinx_bundle + # so score_metamodel is NOT importable: the shared sphinx_conf_helpers + # then stays on its ImportError fallback (empty needs schema, matching + # the current default RTD build) instead of hitting score_metamodel's + # 4.6.1 API which differs from the helper's expectations. + "@score_docs_as_code//src/extensions/score_layout", + "@score_docs_as_code//src/helper_lib", + ], + visibility = ["//visibility:public"], +) + # --------------------------------------------------------------------------- # Lobster traceability – rules_score Bazel implementation # --------------------------------------------------------------------------- diff --git a/bazel/rules/rules_score/docs/development.rst b/bazel/rules/rules_score/docs/development.rst new file mode 100644 index 00000000..3c2e0fa9 --- /dev/null +++ b/bazel/rules/rules_score/docs/development.rst @@ -0,0 +1,23 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +Development +=========== + +.. toctree:: + :maxdepth: 2 + + integration_guide + tooling_architecture + tool_reference/index diff --git a/bazel/rules/rules_score/docs/index.rst b/bazel/rules/rules_score/docs/index.rst index a5e6de94..b1111d7d 100644 --- a/bazel/rules/rules_score/docs/index.rst +++ b/bazel/rules/rules_score/docs/index.rst @@ -20,43 +20,42 @@ safety-critical software according to S-CORE process guidelines. It covers the full artefact lifecycle — from requirements and architecture through safety analysis to the top-level SEooC assembly. +Overview +-------- + .. toctree:: - :maxdepth: 2 - :caption: Overview + :maxdepth: 3 overview +Usage +----- + .. toctree:: - :maxdepth: 2 - :caption: Usage + :maxdepth: 3 + + usage - skills_setup - user_guide/index - rule_reference +Validation +---------- .. toctree:: - :maxdepth: 2 - :caption: Validation + :maxdepth: 3 - tool_reference/specs/bazel_component - tool_reference/specs/class_design_implementation - tool_reference/specs/component_internal_api - tool_reference/specs/component_public_api - tool_reference/specs/component_sequence - tool_reference/specs/sequence_internal_api + validation + +Development +----------- .. toctree:: - :maxdepth: 2 - :caption: Development + :maxdepth: 3 + + development - integration_guide - tooling_architecture - tool_reference/index +Tool Qualification +------------------ .. toctree:: - :maxdepth: 2 - :caption: Tool Qualification + :maxdepth: 3 - Requirements - Traceability Report - quality_report + qualification diff --git a/bazel/rules/rules_score/docs/overview.rst b/bazel/rules/rules_score/docs/overview.rst index c4a24f16..32ba0819 100644 --- a/bazel/rules/rules_score/docs/overview.rst +++ b/bazel/rules/rules_score/docs/overview.rst @@ -15,6 +15,9 @@ Overview ======== +Overview +-------- + ``rules_score`` organises safety-critical software artefacts into four groups: **Documentation Rules** — Sphinx builder and supporting helpers: @@ -42,6 +45,8 @@ Overview All rules support cross-module dependencies for sphinx-needs integration and HTML merging. +.. _overview-quick-reference: + Quick Reference --------------- diff --git a/bazel/rules/rules_score/docs/qualification.rst b/bazel/rules/rules_score/docs/qualification.rst new file mode 100644 index 00000000..0573c8c5 --- /dev/null +++ b/bazel/rules/rules_score/docs/qualification.rst @@ -0,0 +1,23 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +Tool Qualification +================== + +.. toctree:: + :maxdepth: 2 + + Requirements + Traceability Report + quality_report diff --git a/bazel/rules/rules_score/docs/usage.rst b/bazel/rules/rules_score/docs/usage.rst new file mode 100644 index 00000000..c84dbf4c --- /dev/null +++ b/bazel/rules/rules_score/docs/usage.rst @@ -0,0 +1,23 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +Usage +===== + +.. toctree:: + :maxdepth: 2 + + skills_setup + user_guide/index + rule_reference diff --git a/bazel/rules/rules_score/docs/validation.rst b/bazel/rules/rules_score/docs/validation.rst new file mode 100644 index 00000000..09e878e4 --- /dev/null +++ b/bazel/rules/rules_score/docs/validation.rst @@ -0,0 +1,26 @@ +.. + # ******************************************************************************* + # Copyright (c) 2026 Contributors to the Eclipse Foundation + # + # See the NOTICE file(s) distributed with this work for additional + # information regarding copyright ownership. + # + # This program and the accompanying materials are made available under the + # terms of the Apache License Version 2.0 which is available at + # https://www.apache.org/licenses/LICENSE-2.0 + # + # SPDX-License-Identifier: Apache-2.0 + # ******************************************************************************* + +Validation +========== + +.. toctree:: + :maxdepth: 2 + + tool_reference/specs/bazel_component + tool_reference/specs/class_design_implementation + tool_reference/specs/component_internal_api + tool_reference/specs/component_public_api + tool_reference/specs/component_sequence + tool_reference/specs/sequence_internal_api diff --git a/bazel/rules/rules_score/templates/conf.score_layout.template.py b/bazel/rules/rules_score/templates/conf.score_layout.template.py new file mode 100644 index 00000000..47006a1d --- /dev/null +++ b/bazel/rules/rules_score/templates/conf.score_layout.template.py @@ -0,0 +1,307 @@ +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +""" +Sphinx configuration template for SCORE modules using the shared S-CORE layout. + +This mirrors the generic conf.template.py but swaps the stock Read-the-Docs +theme for the shared ``score_layout`` extension (from score_docs_as_code), so +the rendered site matches the baselibs / lifecycle documentation (top +navigation bar instead of the RTD expandable left sidebar). + +This file is auto-generated from a template and should not be edited directly. +Template variables like {PROJECT_NAME} are replaced during Bazel build. +""" + +import json +import os +import sys + +from sphinx.util import logging + +import sphinx_conf_helpers + +# Create a logger with the Sphinx namespace +logger = logging.getLogger(__name__) + + +logger.debug("#" * 80) +logger.debug("# READING CONF.PY") +logger.debug("SYSPATH:" + str(sys.path)) +logger.debug("EMV:" + str(os.environ)) + +for k, v in os.environ.items(): + logger.debug(str(k) + ": " + v) +# Project configuration - {PROJECT_NAME} will be replaced by the module name during build +project = "{PROJECT_NAME}" +author = "S-CORE" +version = "1.0" +release = "1.0.0" +project_url = "https://github.com/eclipse-score" # Required by score_metamodel extension + +# Enable the score_layout built-in version switcher (the same navbar dropdown +# used by the baselibs / lifecycle sites) instead of a custom flyout. When +# github_user / github_repo are set (i.e. not "dummy"), score_layout adds a +# "version-switcher" to the navbar pointing at +# https://.github.io//versions.json. This repo's docs +# are published at https://eclipse-score.github.io/tooling/, so the switcher +# reads https://eclipse-score.github.io/tooling/versions.json (generated by the +# deploy workflow). +html_context = { + "github_user": "eclipse-score", + "github_repo": "tooling", + "github_version": "main", + "doc_path": "bazel/rules/rules_score/docs", +} + +# Remove the "Show Source" link from every page (pydata renders it in the +# secondary "On this page" sidebar unless source links are disabled). +html_show_sourcelink = False + +# Sphinx extensions - comprehensive list for SCORE modules. +# score_layout (from score_docs_as_code) provides the shared S-CORE theme and +# top navigation used by the baselibs / lifecycle documentation sites. It is +# imported via its full package path because this repository's Sphinx binary +# puts the score_docs_as_code repo root (not src/extensions/) on sys.path. +extensions = [ + "sphinx_module_ext", + "sphinx_needs", + "sphinx_design", + "myst_parser", + "sphinxcontrib.plantuml", + "trlc", + "clickable_plantuml", + "sphinx.ext.graphviz", + "src.extensions.score_layout", +] + +# MyST parser extensions +myst_enable_extensions = sphinx_conf_helpers.DEFAULT_MYST_ENABLE_EXTENSIONS + +# Exclude patterns for Bazel builds. Design-fragment subdirectories (e.g. +# units/unit_1_design/) are included via '.. include::' directives and must +# not be treated as standalone pages -- see DEFAULT_EXCLUDE_PATTERNS. +exclude_patterns = sphinx_conf_helpers.DEFAULT_EXCLUDE_PATTERNS + +# Suppress toctree warnings for documents absent from the needs builder's source +# tree. The needs builder runs against only the static docs/ checkout; generated +# files (trlc_rst outputs, renamed_srcs, docs_library_deps) live in bazel-out/ +# and are invisible to it. Their toctree references produce toc.not_readable +# warnings that are cosmetic: the needs builder (sphinx-needs NeedsBuilder) +# captures only `.. need::` directives, not trlc `.. requirement:definition::` +# directives, so needs.json content is unaffected by missing files. +# This suppression is safe for the HTML phase because that phase relocates every +# file into a unified staging directory, so it never encounters toc.not_readable. +suppress_warnings = sphinx_conf_helpers.DEFAULT_SUPPRESS_WARNINGS + +# Enable markdown rendering +source_suffix = { + ".rst": "restructuredtext", + ".md": "markdown", +} + +# Enable numref for cross-references +numfig = True + +# sphinx-needs configuration loaded from the upstream S-CORE metamodel. +# The needs types, extra options, extra links and ID regex are derived +# from score_docs_as_code//src/extensions/score_metamodel:metamodel.yaml +# so they stay in sync with the upstream process description. +# +# Note: score_metamodel is NOT loaded as a Sphinx extension +# (i.e. extensions = [..., "score_metamodel"]) for the following reason: +# When loaded as an extension, score_metamodel registers a build-finished hook +# that runs needs validation via its checks/ modules (mandatory options, +# prohibited words, link pattern checks, etc.). Those check modules do +# bare "from score_metamodel import ..." imports, which require src/extensions/ +# to be on sys.path. That path is only set up by aspect_rules_py's venv +# mechanism, not by the rules_python setup used here. +# Instead, sphinx_conf_helpers calls load_metamodel_data() directly from +# yaml_parser — the score_docs_as_code+ repo root IS on sys.path, so the +# import resolves — and we get only the type/option/regex data without +# activating the validation hooks. +_needs_schema = sphinx_conf_helpers.load_metamodel_needs_schema() +needs_types = _needs_schema["needs_types"] +needs_extra_options = _needs_schema["needs_extra_options"] +needs_extra_links = _needs_schema["needs_extra_links"] +needs_id_regex = _needs_schema["needs_id_regex"] + + +# --------------------------------------------------------------------------- +# Hermetic PlantUML / Graphviz / FTA metamodel tool resolution +# --------------------------------------------------------------------------- +# PLANTUML_BIN, GRAPHVIZ_DOT and FTA_METAMODEL_DIR are injected by the +# sphinx_module Bazel rule via the action env (see _hermetic_tool_env() in +# sphinx_module.bzl). Resolution (path rationale, hermeticity requirements, +# the FTA include-path JVM flag, etc.) is centralised in sphinx_conf_helpers +# so every conf.py -- this default template and any custom conf_template -- +# shares one implementation. See docs/tooling_architecture.rst +# §"Hermetic tool path resolution". +graphviz_dot = sphinx_conf_helpers.resolve_graphviz_dot() +graphviz_output_format = "svg" + +plantuml_output_format = "svg_obj" +# Reuses the graphviz_dot already resolved above instead of re-resolving +# GRAPHVIZ_DOT a second time. +plantuml = sphinx_conf_helpers.resolve_plantuml_command(graphviz_dot_path=graphviz_dot) + +# HTML theme is provided by the score_layout extension (shared S-CORE theme); +# do not set html_theme here. + +logger.debug("#" * 80) + + +# --------------------------------------------------------------------------- +# Home-page section styling +# --------------------------------------------------------------------------- +# The landing page (index.rst) lists the four documentation sections +# (Usage / Validation / Development / Tool Qualification) through a single +# top-level toctree so the pydata top navbar shows exactly those four entries. +# In the page body we want those four to read as section *headings* (like the +# baselibs / lifecycle home pages) rather than plain links, while still keeping +# the auto-generated nested tree beneath them. pydata renders every toctree +# entry as a link, so we restyle just the first-level entries of the home +# page's toctree to look like headings. The rule is scoped to the home page +# (``#score-rules-for-bazel``) so section pages are unaffected. +_HOME_TOC_CSS = """\ +/* Homepage: each top-level group is a real H2 section that references its + landing page via a toctree. The landing page's own self-link duplicates the + section heading, so hide it and surface its children directly under the + heading. */ +#score-rules-for-bazel .toctree-wrapper > ul > li.toctree-l1 > a { + display: none; +} +#score-rules-for-bazel .toctree-wrapper > ul { + list-style: none; + padding-left: 0; + margin: 0; +} +#score-rules-for-bazel .toctree-wrapper > ul > li.toctree-l1 > ul { + padding-left: 2.5rem; + margin: 0; +} +/* Second-level entries get a solid (filled) bullet, third-level entries get a + hollow circle. */ +#score-rules-for-bazel .toctree-wrapper > ul > li.toctree-l1 > ul > li, +#score-rules-for-bazel section > ul.simple > li { + list-style-type: disc; +} +#score-rules-for-bazel .toctree-wrapper li.toctree-l2 ul li, +#score-rules-for-bazel section > ul.simple > li ul li { + list-style-type: circle; +} +/* The hidden landing self-link's list item must not show a stray marker. */ +#score-rules-for-bazel .toctree-wrapper > ul > li.toctree-l1 { + list-style: none; +} +/* Interior content pages (User Guide index, section landing pages, etc.): the + body toctree lists the child page at the top level and its sections nested + beneath. Give the top page entry a solid bullet and every deeper entry a + hollow circle. Homepage rules above use higher-specificity #id selectors and + are unaffected. */ +article .toctree-wrapper > ul { + padding-left: 1.5rem; +} +article .toctree-wrapper li.toctree-l1 { + list-style-type: disc; +} +article .toctree-wrapper li.toctree-l1 li { + list-style-type: circle; +} +/* Requirement / needs objects: the score_metamodel domain renders each item as + a definition list whose signature (
) carries + the anchor "#". By default the pydata theme leaves it unboxed. Wrap each such + signature in a sky-blue box (matching the RTD original) that stays legible in + both light and dark mode. */ +dl.requirement > dt.sig, +dl.need > dt.sig, +dl.definition > dt.sig.sig-object { + background-color: var(--score-req-box-bg, #e7f2fa); + border: 1px solid var(--score-req-box-border, #6ab0de); + border-radius: 4px; + padding: 0.4rem 0.6rem; + margin-bottom: 0.5rem; +} +html[data-theme="dark"] dl.requirement > dt.sig, +html[data-theme="dark"] dl.need > dt.sig, +html[data-theme="dark"] dl.definition > dt.sig.sig-object { + --score-req-box-bg: rgba(56, 139, 253, 0.15); + --score-req-box-border: #388bfd; +} +/* LOBSTER traceability report cards. The pydata theme mutes sphinx-design's + semantic colors, so the status headers ([MISSING]=danger, [OK]=success, + [PARTIAL]=warning) render as washed-out pink / green / yellow and the + per-item "Traces to" issue card picks up a dark surface colour that is + unreadable in light mode. Restore solid, legible status headers and a + neutral, theme-adaptive issue card that reads well in both light and dark + mode. */ +details.sd-card > summary.sd-bg-danger, +.sd-summary-title.sd-bg-danger { + background-color: #dc3545 !important; + color: #fff !important; +} +details.sd-card > summary.sd-bg-success, +.sd-summary-title.sd-bg-success { + background-color: #2e7d32 !important; + color: #fff !important; +} +details.sd-card > summary.sd-bg-warning, +.sd-summary-title.sd-bg-warning { + background-color: #ffc107 !important; + color: #212529 !important; +} +details.sd-card > summary.sd-bg-danger .sd-summary-text, +details.sd-card > summary.sd-bg-success .sd-summary-text { + color: #fff !important; +} +details.sd-card > summary.sd-bg-warning .sd-summary-text { + color: #212529 !important; +} +.lobster-issue-card, +.lobster-issue-card > .sd-card-body { + background-color: transparent !important; + border-color: var(--pst-color-border, #ced4da) !important; +} +.lobster-issue-card .sd-card-text, +.lobster-issue-card p { + color: var(--pst-color-text-base) !important; +} +""" + + +def setup(app): + """Register the home-page section styling. + + The stylesheet is written into the build's ``_static`` directory at + ``build-finished`` (it is not part of a source ``html_static_path``), and + referenced from every page via ``add_css_file``. This keeps the styling + self-contained in the conf template with no extra Bazel-staged asset. + """ + import os + + css_name = "tooling_home.css" + app.add_css_file(css_name) + + def _emit_css(inner_app, _exception): + static_dir = os.path.join(inner_app.outdir, "_static") + os.makedirs(static_dir, exist_ok=True) + with open(os.path.join(static_dir, css_name), "w", encoding="utf-8") as handle: + handle.write(_HOME_TOC_CSS) + + app.connect("build-finished", _emit_css) + + return { + "version": "1.0", + "parallel_read_safe": True, + "parallel_write_safe": True, + } diff --git a/docs/_static/css/version_flyout.css b/docs/_static/css/version_flyout.css deleted file mode 100644 index a86e870d..00000000 --- a/docs/_static/css/version_flyout.css +++ /dev/null @@ -1,138 +0,0 @@ -/* ******************************************************************************* - * Copyright (c) 2026 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * ******************************************************************************* */ - -/* RTD-style version flyout panel */ -.version-flyout { - position: fixed; - bottom: 0; - right: 20px; - z-index: 9999; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; - font-size: 14px; -} - -.version-flyout__toggle { - display: flex; - align-items: center; - gap: 8px; - padding: 8px 16px; - background: #1f1f2e; - color: #fff; - border: none; - border-radius: 6px 6px 0 0; - cursor: pointer; - font-size: 14px; - font-weight: 500; -} - -.version-flyout__toggle:hover { - background: #2a2a3d; -} - -.version-flyout__toggle .flyout-icon { - font-size: 16px; -} - -.version-flyout__toggle .flyout-current { - color: #27ae60; - font-weight: bold; -} - -.version-flyout__toggle .flyout-arrow { - margin-left: auto; - transition: transform 0.2s; -} - -.version-flyout__toggle.active .flyout-arrow { - transform: rotate(180deg); -} - -.version-flyout__panel { - display: none; - background: #1f1f2e; - color: #ccc; - padding: 16px; - border-radius: 6px 6px 0 0; - min-width: 260px; - box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3); -} - -.version-flyout__panel.open { - display: block; -} - -.version-flyout__panel h4 { - color: #fff; - margin: 0 0 8px 0; - font-size: 13px; - text-transform: uppercase; - letter-spacing: 0.5px; -} - -.version-flyout__panel .flyout-section { - margin-bottom: 12px; -} - -.version-flyout__panel .flyout-versions { - display: flex; - flex-wrap: wrap; - gap: 6px; -} - -.version-flyout__panel .flyout-versions a { - color: #55b4d4; - text-decoration: none; - padding: 2px 8px; - border-radius: 3px; - font-size: 13px; -} - -.version-flyout__panel .flyout-versions a:hover { - background: rgba(255, 255, 255, 0.1); - color: #7dd3fc; -} - -.version-flyout__panel .flyout-versions a.active { - color: #27ae60; - font-weight: bold; -} - -.version-flyout__panel .flyout-links { - border-top: 1px solid #333; - padding-top: 10px; - margin-top: 10px; -} - -.version-flyout__panel .flyout-links a { - display: inline-block; - color: #55b4d4; - text-decoration: none; - margin-right: 12px; - font-size: 13px; -} - -.version-flyout__panel .flyout-links a:hover { - color: #7dd3fc; -} - -.version-flyout__footer { - font-size: 11px; - color: #888; - margin-top: 10px; - text-align: center; -} - -.version-flyout__footer a { - color: #55b4d4; - text-decoration: none; -} diff --git a/docs/_static/js/version_flyout.js b/docs/_static/js/version_flyout.js deleted file mode 100644 index 3879310c..00000000 --- a/docs/_static/js/version_flyout.js +++ /dev/null @@ -1,102 +0,0 @@ -// ******************************************************************************* -// Copyright (c) 2026 Contributors to the Eclipse Foundation -// -// See the NOTICE file(s) distributed with this work for additional -// information regarding copyright ownership. -// -// This program and the accompanying materials are made available under the -// terms of the Apache License Version 2.0 which is available at -// https://www.apache.org/licenses/LICENSE-2.0 -// -// SPDX-License-Identifier: Apache-2.0 -// ******************************************************************************* - -/** - * RTD-style version flyout for GitHub Pages. - * Reads versions from switcher.json and renders a floating panel. - */ -(function () { - "use strict"; - - // Determine base URL and current version from the URL path - var pathParts = window.location.pathname.split("/").filter(Boolean); - // Expect: ///... - var repoName = pathParts[0] || ""; - var currentVersion = pathParts[1] || "latest"; - // Handle preview/ pattern - if (currentVersion === "preview" && pathParts[2]) { - currentVersion = "preview/" + pathParts[2]; - } - - var baseUrl = - window.location.origin + "/" + repoName; - var switcherUrl = baseUrl + "/switcher.json"; - - function createFlyout(versions) { - var container = document.createElement("div"); - container.className = "version-flyout"; - - // Build version links - var versionLinks = versions - .map(function (v) { - var activeClass = v.version === currentVersion ? ' class="active"' : ""; - return '" + v.name + ""; - }) - .join("\n"); - - container.innerHTML = - '
' + - '
' + - "

Versions

" + - '
' + - versionLinks + - "
" + - "
" + - ' " + - ' " + - "
" + - '"; - - document.body.appendChild(container); - - // Toggle behavior - var toggle = document.getElementById("flyout-toggle"); - var panel = document.getElementById("flyout-panel"); - toggle.addEventListener("click", function () { - panel.classList.toggle("open"); - toggle.classList.toggle("active"); - }); - } - - function getGitHubRepo() { - // Try to extract from meta or fallback - var metaRepo = document.querySelector('meta[name="github-repo"]'); - if (metaRepo) return metaRepo.getAttribute("content"); - // Fallback based on GitHub Pages domain - var host = window.location.hostname; - var user = host.split(".")[0]; - return user + "/" + repoName; - } - - // Fetch switcher.json and build the flyout - fetch(switcherUrl) - .then(function (response) { - if (!response.ok) throw new Error("switcher.json not found"); - return response.json(); - }) - .then(function (versions) { - createFlyout(versions); - }) - .catch(function (err) { - console.warn("Version flyout: Could not load switcher.json", err); - }); -})();