Compare commits

...

5 commits

Author SHA1 Message Date
Andrew Morgan e4df2002a0
Merge 715e66fa00 into 54944e2866 2025-12-16 18:10:32 +00:00
Kévin Commaille 54944e2866
Fix version selector's historical URL (#2268)
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
* Fix version selector's historical URL

Regression because the function signature changed in #2261, but this
call was not updated.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Add changelog

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
2025-12-16 10:11:47 -07:00
Johannes Marbach 13aa6e83ae
Use more specific names for the version picker CSS classes and add them to the PurgeCSS safelist (#2264)
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
2025-12-05 18:06:17 +00:00
Andrew Morgan 705240da72
Prevent PurgeCSS from deleting dynamically-added version picker CSS classes (#2260) 2025-12-05 15:19:24 +00:00
Johannes Marbach 4dbe080570
Append version number to 'latest' entry in the picker (#2261) 2025-12-05 14:12:05 +00:00
7 changed files with 21 additions and 13 deletions

View file

@ -40,14 +40,14 @@ const currentSegment = segmentMatches ? segmentMatches[0] : undefined;
// fall back to the version as defined in Hugo.
const selected = currentSegment ?? currentVersion;
function appendVersion(parent, name, url) {
function appendVersion(parent, name, segment, url) {
// The list item
const li = document.createElement("li");
if (name === selected) {
li.classList.add("selected");
if (segment === selected) {
li.classList.add("version-picker-selected");
}
if (name === "latest") {
li.classList.add("latest");
if (segment === "latest") {
li.classList.add("version-picker-latest");
}
parent.appendChild(li);
@ -74,7 +74,7 @@ function appendVersion(parent, name, url) {
// Otherwise, stop further event handling and replace the segment
ev.preventDefault();
ev.stopPropagation();
window.location.href = href.replace(`/${currentSegment}/`, `/${name}/`);
window.location.href = href.replace(`/${currentSegment}/`, `/${segment}/`);
});
// The link text
@ -100,14 +100,15 @@ fetch(url)
}
// Add a entries for the unstable version and the "latest" shortcut
appendVersion(ul, "unstable", "https://spec.matrix.org/unstable");
appendVersion(ul, "latest", "https://spec.matrix.org/latest");
appendVersion(ul, "unstable", "unstable", "https://spec.matrix.org/unstable");
const latestName = versions?.length ? `latest (${versions[0].name})` : "latest";
appendVersion(ul, latestName, "latest", "https://spec.matrix.org/latest");
// Add an entry for each proper version
for (const version of versions) {
appendVersion(ul, version.name, `https://spec.matrix.org/${version.name}`);
appendVersion(ul, version.name, version.name, `https://spec.matrix.org/${version.name}`);
}
// For historical versions, simply link to the changelog
appendVersion(ul, "historical", '{{ (site.GetPage "changelog/historical").RelPermalink }}');
appendVersion(ul, "historical", "historical", '{{ (site.GetPage "changelog/historical").RelPermalink }}');
});

View file

@ -51,17 +51,17 @@ Custom SCSS for the Matrix spec
color: $black;
}
/* Make the version dropdown scroll if its too large */
/* Make the version dropdown scroll if it's too large */
ul#version-selector {
max-height: 80vh;
overflow-y: auto;
}
ul#version-selector li.selected a {
ul#version-selector li.version-picker-selected a {
font-weight: bold;
}
ul#version-selector li.latest a {
ul#version-selector li.version-picker-latest a {
color: $secondary;
}
}

View file

@ -0,0 +1 @@
Add version picker in the navbar.

View file

@ -0,0 +1 @@
Add version picker in the navbar.

View file

@ -0,0 +1 @@
Add version picker in the navbar.

View file

@ -0,0 +1 @@
Add version picker in the navbar.

View file

@ -16,6 +16,9 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
extensions: ["json"],
},
],
// As these classes are only applied by JavaScript, PurgeCSS doesn't see them
// in the source code and removes them unless we explicitly tell it not to.
safelist: ['version-picker-selected', 'version-picker-latest']
});
module.exports = {