Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gal/multi docs #72

Merged
merged 5 commits into from
Nov 10, 2021
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# Python
__pycache__/
.python-version

# Temp files
*.tmp
Expand All @@ -23,3 +24,9 @@ node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
docs/.vuepress/_state.json
docs/.vuepress/public/notebooks/
docs/guide/_domainspec.md
docs/guide/_examples.md
docs/guide/_solverspec.md
docs/reference/
75 changes: 75 additions & 0 deletions docs/.vuepress/components/versions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<span class="nav-item" v-if="options && options.length > 0">
Version:
<select v-model="selected" @change="onChange">
<option v-for="option in options" :value="option.value">
{{ option.text }}
</option>
</select>
</span>
</template>

<script>
import Axios from "axios";
export default {
data() {
return {
selected: undefined,
options: [],
};
},
created: async function () {
try {
let res = await Axios.get(
"https://api.github.com/repos/airbus/scikit-decide/git/trees/gh-pages"
);
const versionNode = res.data.tree.find((e) => {
return e.path.toLowerCase() === "version";
});
res = await Axios.get(versionNode.url);
this.options = res.data.tree.map((e) => {
return { value: e.path, text: e.path };
});
this.options.sort((e1, e2) => {
const e1Arr = e1.text.split(".");
const e2Arr = e2.text.split(".");
for (let i = 0; i < e1Arr.length && i < e2Arr.length; i++) {
const e1V = parseInt(e1Arr[i]);
const e2V = parseInt(e2Arr[i]);
if (e1V !== e2V) return e2V - e1V;
if (e1Arr[i] !== e2Arr[i]) return e2Arr[i] - e1Arr[i];
}
return e1.text === e2.text ? 0 : e2.text < e1.text ? -1 : 1;
});
this.options.unshift({ value: "main", text: "dev" });
const path = window.location.pathname.toLowerCase();
if (path.startsWith("/scikit-decide/version/")) {
const start = 23;
const end = path.indexOf("/", start);
this.selected = path.substring(start, end);
} else {
this.selected = "main";
}
} catch (ex) {}
},
methods: {
onChange(event) {
const targetVersionPath =
this.selected === "main" ? "" : `/version/${this.selected}`;
const path = window.location.pathname.toLowerCase();
let startIdx = 14; // len("/scikit-decide")
const versionIdx = path.indexOf("/version/");
if (versionIdx >= 0) {
startIdx = versionIdx + 9; // len("/version/")
}

const endIdx = path.indexOf("/", startIdx);

window.location.pathname =
window.location.pathname.substring(0, 14) +
targetVersionPath +
window.location.pathname.substring(endIdx);
},
},
};
</script>
56 changes: 56 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module.exports = {
lang: 'en-US',
title: 'Scikit-decide',
description: 'This is scikit-decide documentation site',
base: `/scikit-decide${process.env.DOCS_VERSION_PATH || '/'}`,

locales: {
'/': {
lang: 'en-US',
title: 'Scikit-decide',
description: 'This is scikit-decide documentation',
},
},

themeConfig: {
repo: 'airbus/scikit-decide',
logo: '/logo.svg',
editLinks: false,
docsDir: '',
editLinkText: '',
lastUpdated: false,
locales: {
'/': {
selectLanguageName: 'en-US',
},
},
nav: [
{
text: 'Home',
link: '/'
},
{
text: 'Guide',
link: '/guide/'
},
{
text: 'Reference',
link: '/reference/'
},
],
sidebar: 'auto',
markdown: {
toc: {
includeLevel: [2]
}
},
},

plugins: {
'@vuepress/plugin-back-to-top': {},
'mathjax': {
target: 'svg',
macros: { '*': '\\times' }
},
},
}
23 changes: 0 additions & 23 deletions docs/.vuepress/config.yml

This file was deleted.

56 changes: 56 additions & 0 deletions docs/.vuepress/public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading