Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- devel-2.0
- master
workflow_dispatch:

permissions:
Expand All @@ -20,17 +19,25 @@ jobs:
build:
name: Build documentation
runs-on: ubuntu-latest
env:
BLEND_DOC_VERSIONS: '[["devel-2.0","https://bioye97.github.io/blend/"],["2.0.0","https://bioye97.github.io/blend/2.0.0/"]]'
steps:
- name: Checkout
- name: Checkout BLEND development source
uses: actions/checkout@v6
with:
ref: devel-2.0

- name: Checkout BLEND 2.0.0 source
uses: actions/checkout@v6
with:
repository: Bioye97/blend
ref: v2.0.0
path: _versions/blend-2.0.0

- name: Define documentation versions
- name: Add version selector support to BLEND 2.0.0
run: |
{
echo 'BLEND_DOC_VERSIONS<<EOF'
echo '[["devel-2.0","https://bioye97.github.io/blend/"],["2.0.0","https://bioye97.github.io/blend/2.0.0/"]]'
echo 'EOF'
} >> "${GITHUB_ENV}"
cp doc/rst/source/conf.py _versions/blend-2.0.0/doc/rst/source/conf.py
cp doc/rst/source/_static/blend.js _versions/blend-2.0.0/doc/rst/source/_static/blend.js

- name: Set up Python
uses: actions/setup-python@v6
Expand Down Expand Up @@ -67,7 +74,7 @@ jobs:

- name: Configure 2.0.0 documentation
run: |
cmake -S . -B build-2.0.0 \
cmake -S _versions/blend-2.0.0 -B build-2.0.0 \
-DBLEND_BUILD_DOCS=ON \
-DBLEND_BUILD_EXAMPLES=OFF \
-DBLEND_BUILD_TESTS=OFF \
Expand Down
31 changes: 29 additions & 2 deletions doc/rst/source/_static/blend.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,36 @@

for (i = 0; i < selects.length; i++) {
selects[i].addEventListener("change", function () {
if (this.value) {
window.location.href = this.value;
var base;
var candidate;
var currentBase = null;
var j;
var relativePath;
var target;

if (!this.value) {
return;
}

for (j = 0; j < this.options.length; j++) {
candidate = new URL(this.options[j].value, window.location.href);
if (candidate.origin === window.location.origin &&
window.location.pathname.indexOf(candidate.pathname) === 0 &&
(!currentBase || candidate.pathname.length > currentBase.pathname.length)) {
currentBase = candidate;
}
}

target = new URL(this.value, window.location.href);
if (currentBase) {
base = currentBase.pathname;
relativePath = window.location.pathname.substring(base.length);
target = new URL(relativePath, target);
target.search = window.location.search;
target.hash = window.location.hash;
}

window.location.href = target.href;
});
}
});
Expand Down