Skip to content

Commit 4381ca7

Browse files
version switcher
* version switcher * fix switcher bug
1 parent 13f8099 commit 4381ca7

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

docs/pyagentspec/source/_static/landing.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ p.detail-title {
111111
}
112112

113113
a {
114-
display: inline !important;
115114
color:#f29111;
116115
}
117116

docs/pyagentspec/source/conf.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os
1818
import sys
1919
from pathlib import Path
20+
from typing import Any
2021

2122
from sphinx.application import Sphinx
2223

@@ -40,9 +41,6 @@
4041
# We add stable as current version, we might add the version switch in the future
4142
tags.add("stable") # type: ignore
4243

43-
# The short X.Y version.
44-
version = ".".join(pyagentspec.__version__.split(".")[:2])
45-
4644
# The full version, including alpha/beta/rc tags.
4745
release = pyagentspec.__version__
4846

@@ -51,6 +49,14 @@
5149
if stable_release is None:
5250
raise Exception("Error: STABLE_RELEASE environment variable is not set.")
5351

52+
docs_version = os.getenv("DOCS_VERSION")
53+
54+
if not docs_version:
55+
if any(x in release for x in (".dev", "a", "b", "rc")):
56+
docs_version = "dev"
57+
else:
58+
docs_version = stable_release
59+
5460
# -- General configuration ---------------------------------------------------
5561

5662
# Add any Sphinx extension module names here, as strings. They can be
@@ -148,7 +154,11 @@
148154
"pygments_light_style": "xcode", # for light mode
149155
"pygments_dark_style": "monokai", # for dark mode
150156
"navbar_align": "left",
151-
"navbar_start": ["navbar-logo"],
157+
"navbar_start": ["navbar-logo", "version-switcher"],
158+
"switcher": {
159+
"json_url": "https://oracle.github.io/agent-spec/switcher.json",
160+
"version_match": docs_version,
161+
},
152162
"navbar_center": [
153163
"navbar-new"
154164
], # Custom top navigation - defined in the template, navbar-new.html, in the _templates dir.
@@ -179,7 +189,7 @@
179189
copybutton_prompt_is_regexp = True
180190

181191

182-
def autodoc_skip_member(app: Sphinx, what, name, obj, skip, options):
192+
def autodoc_skip_member(app: Sphinx, what, name, obj, skip, options): # type: ignore
183193
"""
184194
Skips showing an attribute as a member if it is already in the list of parameters.
185195
This prevents duplicated fields in Pydantic / dataclasses.
@@ -191,7 +201,7 @@ def autodoc_skip_member(app: Sphinx, what, name, obj, skip, options):
191201
return skip
192202

193203

194-
def setup(app: Sphinx):
204+
def setup(app: Sphinx) -> dict[str, Any]:
195205
app.connect("autodoc-skip-member", autodoc_skip_member)
196206
app.add_js_file("js/fix-navigation.js")
197207

0 commit comments

Comments
 (0)