Skip to content

Commit

Permalink
Merge branch 'master' into continue_compression
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarusA committed Sep 22, 2024
2 parents 96d46c2 + f73d520 commit 73eab43
Show file tree
Hide file tree
Showing 14 changed files with 374 additions and 79 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build
.vscode
*.zarr
*.nc
*.tif
var

*.ipynb_checkpoints
Expand All @@ -28,4 +29,5 @@ docs/node_modules
docs/.vitepress/cache
docs/.vitepress/dist
docs/.DS_Store
docs/package-lock.json
docs/package-lock.json
*.tif
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ YAXArrayBase = "90b8fcef-0c2d-428d-9c56-5f86629e9d14"
[compat]
CFTime = "0.0, 0.1"
DataStructures = "0.17, 0.18"
DimensionalData = "0.27"
DimensionalData = "0.27, 0.28"
DiskArrayTools = "0.1"
DiskArrays = "0.3,0.4"
DiskArrays = "0.3, 0.4"
DocStringExtensions = "0.8, 0.9"
Glob = "1.3"
Interpolations = "0.12, 0.13, 0.14, 0.15"
Expand All @@ -54,5 +54,5 @@ Statistics = "1"
StatsBase = "0.32, 0.33, 0.34"
Tables = "0.2, 1.0"
WeightedOnlineStats = "0.3, 0.4, 0.5, 0.6"
YAXArrayBase = "0.6,0.7"
YAXArrayBase = "0.6, 0.7"
julia = "1.9"
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"markdown-it": "^14.0.0",
"markdown-it-mathjax3": "^4.3.2",
"vitepress-plugin-tabs": "^0.5.0",
"vitepress": "^1.3.4",
"vitest": "^1.3.0"
}
}
136 changes: 79 additions & 57 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,82 @@ import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import mathjax3 from "markdown-it-mathjax3";

function getBaseRepository(base: string): string {
if (!base) return '/';
// I guess if deploy_url is available. From where do I check this ?
const parts = base.split('/').filter(Boolean);
return parts.length > 0 ? `/${parts[0]}/` : '/';
}

const baseTemp = {
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
}

const navTemp = {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Get Started', link: '/get_started' },
{
text: 'User Guide',
items: [
{ text: 'Types', link: '/UserGuide/types' },
{ text: 'Read', link: '/UserGuide/read' },
{ text: 'Write', link: '/UserGuide/write' },
{ text: 'Convert', link: '/UserGuide/convert' },
{ text: 'Create', link: '/UserGuide/create' },
{ text: 'Select', link: '/UserGuide/select' },
{ text: 'Compute', link: '/UserGuide/compute' },
{ text: 'Chunk', link: '/UserGuide/chunk' },
{ text: 'Cache', link: '/UserGuide/cache' },
{ text: 'Group', link: '/UserGuide/group' },
{ text: 'Combine', link: '/UserGuide/combine' },
{ text: 'FAQ', link: '/UserGuide/faq' }
]
},
{
text: 'Tutorials',
items: [
{ text: 'Overview', link: '/tutorials/tutorial' },
{ text: 'Plotting maps', link: '/tutorials/plottingmaps' },
{ text: 'Mean Seasonal Cycle', link: '/tutorials/mean_seasonal_cycle' },
{
text: 'ESDL studies',
items: [
{ text: 'ESDL study 1', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_1.jl' },
{ text: 'ESDL study 2', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_2.jl' },
{ text: 'ESDL study 3', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_3.jl' },
{ text: 'ESDL study 4', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_4.jl' },
]
},
{ text: 'Other Tutorials', link: '/tutorials/other_tutorials' },
]
},
{ text: 'Ecosystem',
items: [
{ text: 'DimensionalData.jl', link: 'https://rafaqz.github.io/DimensionalData.jl/dev/' },
{ text: 'NetCDF.jl', link: 'https://juliageo.org/NetCDF.jl/stable/'},
{ text: 'Zarr.jl', link: 'https://juliaio.github.io/Zarr.jl/latest/'},
{ text: 'ArchGDAL.jl', link: 'https://yeesian.com/ArchGDAL.jl/stable/' },
{ text: 'GeoMakie.jl', link: 'https://geo.makie.org/dev/' },
{ text: 'Makie.jl', link: 'https://docs.makie.org/dev/' },
]
},
{
text: 'Development',
items: [
{ text: 'Contribute', link: 'development/contribute' },
{ text: 'Contributors', link: 'development/contributors' }
]
},
],
}

const nav = [
...navTemp.nav,
{
component: 'VersionPicker'
}
]
// https://vitepress.dev/reference/site-config
export default defineConfig({
base: 'REPLACE_ME_DOCUMENTER_VITEPRESS',
Expand All @@ -12,6 +88,8 @@ export default defineConfig({
outDir: 'REPLACE_ME_DOCUMENTER_VITEPRESS', // This is required for MarkdownVitepress to work correctly...
head: [
['link', { rel: 'icon', href: 'REPLACE_ME_DOCUMENTER_VITEPRESS_FAVICON' }],
['script', {src: `${getBaseRepository(baseTemp.base)}versions.js`}],
['script', {src: `${baseTemp.base}siteinfo.js`}]
],
// ignoreDeadLinks: true,

Expand All @@ -36,63 +114,7 @@ export default defineConfig({
detailedView: true
}
},
nav: [
{ text: 'Home', link: '/' },
{ text: 'Get Started', link: '/get_started' },
{
text: 'User Guide',
items: [
{ text: 'Types', link: '/UserGuide/types' },
{ text: 'Read', link: '/UserGuide/read' },
{ text: 'Write', link: '/UserGuide/write' },
{ text: 'Convert', link: '/UserGuide/convert' },
{ text: 'Create', link: '/UserGuide/create' },
{ text: 'Select', link: '/UserGuide/select' },
{ text: 'Compute', link: '/UserGuide/compute' },
{ text: 'Chunk', link: '/UserGuide/chunk' },
{ text: 'Cache', link: '/UserGuide/cache' },
{ text: 'Group', link: '/UserGuide/group' },
{ text: 'Combine', link: '/UserGuide/combine' },
{ text: 'FAQ', link: '/UserGuide/faq' }
]
},
{
text: 'Tutorials',
items: [
{ text: 'Overview', link: '/tutorials/tutorial' },
{ text: 'Plotting maps', link: '/tutorials/plottingmaps' },
{ text: 'Mean Seasonal Cycle', link: '/tutorials/mean_seasonal_cycle' },
{
text: 'ESDL studies',
items: [
{ text: 'ESDL study 1', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_1.jl' },
{ text: 'ESDL study 2', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_2.jl' },
{ text: 'ESDL study 3', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_3.jl' },
{ text: 'ESDL study 4', link: 'https://github.com/JuliaDataCubes/YAXArrays.jl/blob/master/docs/src/tutorials/esdl/examples_from_esdl_study_4.jl' },
]
},
{ text: 'Other Tutorials', link: '/tutorials/other_tutorials' },
]
},
{ text: 'Ecosystem',
items: [
{ text: 'DimensionalData.jl', link: 'https://rafaqz.github.io/DimensionalData.jl/dev/' },
{ text: 'NetCDF.jl', link: 'https://juliageo.org/NetCDF.jl/stable/'},
{ text: 'Zarr.jl', link: 'https://juliaio.github.io/Zarr.jl/latest/'},
{ text: 'ArchGDAL.jl', link: 'https://yeesian.com/ArchGDAL.jl/stable/' },
{ text: 'GeoMakie.jl', link: 'https://geo.makie.org/dev/' },
{ text: 'Makie.jl', link: 'https://docs.makie.org/dev/' },
]
},
{
text: 'Development',
items: [
{ text: 'Contribute', link: 'development/contribute' },
{ text: 'Contributors', link: 'development/contributors' }
]
},
],

nav,
sidebar: [
{ text: 'Get Started', link: '/get_started' },
{ text: 'API Reference', link: '/api' },
Expand Down
142 changes: 142 additions & 0 deletions docs/src/.vitepress/theme/VersionPicker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<!-- Adapted from https://github.com/MakieOrg/Makie.jl/blob/master/docs/src/.vitepress/theme/VersionPicker.vue -->

<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { useData } from 'vitepress'
import VPNavBarMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue'
import VPNavScreenMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue'
// Extend the global Window interface to include DOC_VERSIONS and DOCUMENTER_CURRENT_VERSION
declare global {
interface Window {
DOC_VERSIONS?: string[];
DOCUMENTER_CURRENT_VERSION?: string;
}
}
const props = defineProps<{
screenMenu?: boolean
}>()
const versions = ref<Array<{ text: string, link: string }>>([]);
const currentVersion = ref('Versions');
const isClient = ref(false);
const { site } = useData()
const isLocalBuild = () => {
return typeof window !== 'undefined' && (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
}
const getBaseRepository = () => {
if (typeof window === 'undefined') return ''; // Handle server-side rendering (SSR)
const { origin, pathname } = window.location;
// Check if it's a GitHub Pages (or similar) setup
if (origin.includes('github.io')) {
// Extract the first part of the path as the repository name
const pathParts = pathname.split('/').filter(Boolean);
const baseRepo = pathParts.length > 0 ? `/${pathParts[0]}/` : '/';
return `${origin}${baseRepo}`;
} else {
// For custom domains, use just the origin (e.g., https://docs.makie.org)
return origin;
}
};
const waitForScriptsToLoad = () => {
return new Promise<boolean>((resolve) => {
if (isLocalBuild()) {
resolve(false);
return;
}
const checkInterval = setInterval(() => {
if (window.DOC_VERSIONS && window.DOCUMENTER_CURRENT_VERSION) {
clearInterval(checkInterval);
resolve(true);
}
}, 100);
// Timeout after 5 seconds
setTimeout(() => {
clearInterval(checkInterval);
resolve(false);
}, 5000);
});
};
const loadVersions = async () => {
if (typeof window === 'undefined') return; // Guard for SSR
try {
if (isLocalBuild()) {
// Handle the local build scenario directly
const fallbackVersions = ['dev'];
versions.value = fallbackVersions.map(v => ({
text: v,
link: '/'
}));
currentVersion.value = 'dev';
} else {
// For non-local builds, wait for scripts to load
const scriptsLoaded = await waitForScriptsToLoad();
const getBaseRepositoryPath = computed(() => {
return getBaseRepository();
});
if (scriptsLoaded && window.DOC_VERSIONS && window.DOCUMENTER_CURRENT_VERSION) {
versions.value = window.DOC_VERSIONS.map((v: string) => ({
text: v,
link: `${getBaseRepositoryPath.value}/${v}/`
}));
currentVersion.value = window.DOCUMENTER_CURRENT_VERSION;
} else {
// Fallback logic if scripts fail to load or are not available
const fallbackVersions = ['dev'];
versions.value = fallbackVersions.map(v => ({
text: v,
link: `${getBaseRepositoryPath.value}/${v}/`
}));
currentVersion.value = 'dev';
}
}
} catch (error) {
console.warn('Error loading versions:', error);
// Use fallback logic in case of an error
const fallbackVersions = ['dev'];
const getBaseRepositoryPath = computed(() => {
return getBaseRepository();
});
versions.value = fallbackVersions.map(v => ({
text: v,
link: `${getBaseRepositoryPath.value}/${v}/`
}));
currentVersion.value = 'dev';
}
isClient.value = true;
};
onMounted(loadVersions);
</script>

<template>
<template v-if="isClient">
<VPNavBarMenuGroup
v-if="!screenMenu && versions.length > 0"
:item="{ text: currentVersion, items: versions }"
class="VPVersionPicker"
/>
<VPNavScreenMenuGroup
v-else-if="screenMenu && versions.length > 0"
:text="currentVersion"
:items="versions"
class="VPVersionPicker"
/>
</template>
</template>

<style scoped>
.VPVersionPicker :deep(button .text) {
color: var(--vp-c-text-1) !important;
}
.VPVersionPicker:hover :deep(button .text) {
color: var(--vp-c-text-2) !important;
}
</style>
4 changes: 3 additions & 1 deletion docs/src/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import AsideTrustees from '../../components/AsideTrustees.vue'
import VersionPicker from "./VersionPicker.vue"

import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
import './style.css'
Expand All @@ -15,6 +16,7 @@ export default {
})
},
enhanceApp({ app, router, siteData }) {
enhanceAppWithTabs(app)
enhanceAppWithTabs(app);
app.component('VersionPicker', VersionPicker);
}
} satisfies Theme
14 changes: 14 additions & 0 deletions docs/src/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,18 @@ mjx-container > svg {
/* Style for output code blocks */
.language- {
background-color: var(--vp-c-bg-output) !important;
}

/* Component: Docstring Custom Block */

.jldocstring.custom-block {
border: 1px solid var(--vp-c-gray-2);
color: var(--vp-c-text-1)
}

.jldocstring.custom-block summary {
font-weight: 700;
cursor: pointer;
user-select: none;
margin: 0 0 8px;
}
Loading

0 comments on commit 73eab43

Please sign in to comment.