From c67bd769d25d8fcace170c08fed1e50dcd3c1b03 Mon Sep 17 00:00:00 2001 From: sfaqer Date: Wed, 30 Oct 2024 19:33:22 +1000 Subject: [PATCH] =?UTF-8?q?#8=20=D0=9E=D1=82=D0=BA=D0=B0=D0=B7=20=D0=BE?= =?UTF-8?q?=D1=82=20=D1=80=D0=B5=D1=80=D0=B0=D0=B9=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B2=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=8F=D0=B4=D0=BA=D0=B0=20=D0=B2=D0=BD=D1=83=D1=82?= =?UTF-8?q?=D1=80=D0=B8=20=D1=81=D0=B0=D0=BC=D0=BE=D0=B3=D0=BE=20md=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/config.mts | 28 +++++++++++++------ .../additional-processing.md | 1 + docs/framework-elements/aliases-grouping.md | 1 + docs/framework-elements/aliases.md | 1 + .../annotation-inheritance.md | 1 + .../annotations-processing.md | 1 + docs/framework-elements/app-context.md | 1 + .../app-settings-injection.md | 1 + .../component-declaration.md | 1 + docs/framework-elements/component-instance.md | 1 + .../component-overriding.md | 1 + .../component-post-initialization.md | 1 + .../component-uniqueness.md | 1 + docs/framework-elements/components-binding.md | 1 + docs/framework-elements/components-factory.md | 1 + .../components-prioritization.md | 1 + docs/framework-elements/components-sorting.md | 1 + .../conditional-registration.md | 1 + docs/framework-elements/custom-annotations.md | 1 + docs/framework-elements/custom-arguments.md | 1 + .../dependency-injection.md | 1 + docs/framework-elements/instance-generator.md | 1 + .../launch-control-inversion.md | 1 + .../{10-about-autumn.md => about-autumn.md} | 1 + ...nal-packages.md => additional-packages.md} | 1 + .../{20-first-steps.md => first-steps.md} | 1 + 26 files changed, 44 insertions(+), 9 deletions(-) rename docs/getting-started/{10-about-autumn.md => about-autumn.md} (99%) rename docs/getting-started/{30-additional-packages.md => additional-packages.md} (99%) rename docs/getting-started/{20-first-steps.md => first-steps.md} (99%) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 6784384..cef3241 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -32,10 +32,6 @@ export default defineConfig({ // https://vitepress.dev/reference/site-config#base base: "/docs", - rewrites(id) { - return id.replace(/\d+-/, '').replace(/\\/, '/') - }, - cleanUrls: true, locales: { @@ -90,6 +86,11 @@ interface SidebarOptions { collapsed: boolean; } +// type _SidebarItem = DefaultTheme.SidebarItem & { order: string } +interface OrderedSidebarItem extends DefaultTheme.SidebarItem { + order: number; +} + function getSidebar({ contentRoot, contentDirs, collapsed }: SidebarOptions): DefaultTheme.SidebarItem[] { const sidebar: DefaultTheme.SidebarItem[] = []; @@ -113,7 +114,7 @@ function getSidebarConfig(contentRoot, contentDir, text, collapsed): DefaultThem } function getSidebarItems(contentRoot, contentDir): DefaultTheme.SidebarItem[] { - const sidebarItems: DefaultTheme.SidebarItem[] = []; + const sidebarItems: OrderedSidebarItem[] = []; const cwd = `${process.cwd()}/${contentRoot}`; const files = glob.sync(`${contentDir}/*.md`, { cwd }).sort(); @@ -123,11 +124,20 @@ function getSidebarItems(contentRoot, contentDir): DefaultTheme.SidebarItem[] { sidebarItems.push(sidebarItem); } + sidebarItems.sort((first, second) => { + if (first.order >= second.order) { + return 1; + } else if (second.order >= first.order) { + return -1; + } else { + return 0; + } + }) return sidebarItems; } -function getSidebarItem(contentRoot, file): DefaultTheme.SidebarItem { +function getSidebarItem(contentRoot, file): OrderedSidebarItem { const fileName = path.basename(file, '.md'); const pageName = fileName .replace(/^\d+-/, '') @@ -138,10 +148,10 @@ function getSidebarItem(contentRoot, file): DefaultTheme.SidebarItem { const fileContent = fs.readFileSync(path.join(contentRoot, file), 'utf8'); const { data: frontmatter } = matter(fileContent); - const sidebarItem: DefaultTheme.SidebarItem = { + const sidebarItem: OrderedSidebarItem = { text: frontmatter.title || pageName, - link: "/" + file.replace(/\d+-/, '').replace(/\\/, '/'), - // order: frontmatter.order || 0 + link: "/" + file.replace(/\\/, '/'), + order: frontmatter.order || Number.MAX_VALUE }; return sidebarItem; diff --git a/docs/framework-elements/additional-processing.md b/docs/framework-elements/additional-processing.md index c8ae22b..95a17a2 100644 --- a/docs/framework-elements/additional-processing.md +++ b/docs/framework-elements/additional-processing.md @@ -1,5 +1,6 @@ --- title: Дополнительная обработка компонента +order: 150 --- # Дополнительная обработка компонента diff --git a/docs/framework-elements/aliases-grouping.md b/docs/framework-elements/aliases-grouping.md index bb0af6d..7a3cd71 100644 --- a/docs/framework-elements/aliases-grouping.md +++ b/docs/framework-elements/aliases-grouping.md @@ -1,5 +1,6 @@ --- title: Группировка компонентов по алиасу +order: 220 --- # Группировка компонентов по алиасу diff --git a/docs/framework-elements/aliases.md b/docs/framework-elements/aliases.md index 601d4df..5f7471c 100644 --- a/docs/framework-elements/aliases.md +++ b/docs/framework-elements/aliases.md @@ -1,5 +1,6 @@ --- title: Алиасы компонентов +order: 90 --- # Алиасы компонентов diff --git a/docs/framework-elements/annotation-inheritance.md b/docs/framework-elements/annotation-inheritance.md index e3ce1ff..3f66afb 100644 --- a/docs/framework-elements/annotation-inheritance.md +++ b/docs/framework-elements/annotation-inheritance.md @@ -1,5 +1,6 @@ --- title: Наследование аннотаций +order: 200 --- # Наследование аннотаций diff --git a/docs/framework-elements/annotations-processing.md b/docs/framework-elements/annotations-processing.md index 12e02a4..f67d1f2 100644 --- a/docs/framework-elements/annotations-processing.md +++ b/docs/framework-elements/annotations-processing.md @@ -1,5 +1,6 @@ --- title: Обработка аннотаций +order: 210 --- # Обработка аннотаций diff --git a/docs/framework-elements/app-context.md b/docs/framework-elements/app-context.md index 5a1ca4f..a1baaac 100644 --- a/docs/framework-elements/app-context.md +++ b/docs/framework-elements/app-context.md @@ -1,5 +1,6 @@ --- title: Использование контекста приложения +order: 160 --- # Использование контекста приложения diff --git a/docs/framework-elements/app-settings-injection.md b/docs/framework-elements/app-settings-injection.md index 9bd975a..5457813 100644 --- a/docs/framework-elements/app-settings-injection.md +++ b/docs/framework-elements/app-settings-injection.md @@ -1,5 +1,6 @@ --- title: Внедрение настроек приложения +order: 60 --- # Внедрение настроек приложения diff --git a/docs/framework-elements/component-declaration.md b/docs/framework-elements/component-declaration.md index 840ac2d..721bf30 100644 --- a/docs/framework-elements/component-declaration.md +++ b/docs/framework-elements/component-declaration.md @@ -1,5 +1,6 @@ --- title: Объявление компонента +order: 10 --- # Объявление компонента diff --git a/docs/framework-elements/component-instance.md b/docs/framework-elements/component-instance.md index f582804..25c4eab 100644 --- a/docs/framework-elements/component-instance.md +++ b/docs/framework-elements/component-instance.md @@ -1,5 +1,6 @@ --- title: Получение экземпляра компонента +order: 20 --- # Получение экземпляра компонента diff --git a/docs/framework-elements/component-overriding.md b/docs/framework-elements/component-overriding.md index 0671d54..64b6bf6 100644 --- a/docs/framework-elements/component-overriding.md +++ b/docs/framework-elements/component-overriding.md @@ -1,5 +1,6 @@ --- title: Переопределение компонента по имени +order: 120 --- # Переопределение компонента по имени diff --git a/docs/framework-elements/component-post-initialization.md b/docs/framework-elements/component-post-initialization.md index 20c56f1..30b5b9f 100644 --- a/docs/framework-elements/component-post-initialization.md +++ b/docs/framework-elements/component-post-initialization.md @@ -1,5 +1,6 @@ --- title: Пост-инициализация компонента +order: 130 --- # Пост-инициализация компонента diff --git a/docs/framework-elements/component-uniqueness.md b/docs/framework-elements/component-uniqueness.md index 9ca2495..110aad6 100644 --- a/docs/framework-elements/component-uniqueness.md +++ b/docs/framework-elements/component-uniqueness.md @@ -1,5 +1,6 @@ --- title: Уникальность экземпляров компонентов +order: 140 --- # Уникальность экземпляров компонентов diff --git a/docs/framework-elements/components-binding.md b/docs/framework-elements/components-binding.md index e954dac..f6ff2bd 100644 --- a/docs/framework-elements/components-binding.md +++ b/docs/framework-elements/components-binding.md @@ -1,5 +1,6 @@ --- title: Связывание компонентов между собой +order: 30 --- # Связывание компонентов между собой diff --git a/docs/framework-elements/components-factory.md b/docs/framework-elements/components-factory.md index 24ff861..e3298d3 100644 --- a/docs/framework-elements/components-factory.md +++ b/docs/framework-elements/components-factory.md @@ -1,5 +1,6 @@ --- title: Фабрика компонентов +order: 40 --- # Фабрика компонентов diff --git a/docs/framework-elements/components-prioritization.md b/docs/framework-elements/components-prioritization.md index 68a5528..5609737 100644 --- a/docs/framework-elements/components-prioritization.md +++ b/docs/framework-elements/components-prioritization.md @@ -1,5 +1,6 @@ --- title: Приоритизация компонентов с общим алиасом +order: 110 --- # Приоритизация компонентов с общим алиасом diff --git a/docs/framework-elements/components-sorting.md b/docs/framework-elements/components-sorting.md index 1d16d2a..f2ef1d7 100644 --- a/docs/framework-elements/components-sorting.md +++ b/docs/framework-elements/components-sorting.md @@ -1,5 +1,6 @@ --- title: Упорядочивание компонентов при получении в виде сортированных коллекций +order: 100 --- # Упорядочивание компонентов при получении в виде сортированных коллекций diff --git a/docs/framework-elements/conditional-registration.md b/docs/framework-elements/conditional-registration.md index 06260c6..84e174d 100644 --- a/docs/framework-elements/conditional-registration.md +++ b/docs/framework-elements/conditional-registration.md @@ -1,5 +1,6 @@ --- title: Условная регистрация компонентов в контексте приложения +order: 170 --- # Условная регистрация компонентов в контексте приложения diff --git a/docs/framework-elements/custom-annotations.md b/docs/framework-elements/custom-annotations.md index c3b08a5..1993a6e 100644 --- a/docs/framework-elements/custom-annotations.md +++ b/docs/framework-elements/custom-annotations.md @@ -1,5 +1,6 @@ --- title: Собственные аннотации +order: 190 --- # Собственные аннотации diff --git a/docs/framework-elements/custom-arguments.md b/docs/framework-elements/custom-arguments.md index 42f2c6a..1c18a52 100644 --- a/docs/framework-elements/custom-arguments.md +++ b/docs/framework-elements/custom-arguments.md @@ -1,5 +1,6 @@ --- title: Произвольные аргументы конструктора +order: 80 --- # Произвольные аргументы конструктора diff --git a/docs/framework-elements/dependency-injection.md b/docs/framework-elements/dependency-injection.md index e7fb7e1..7a6306b 100644 --- a/docs/framework-elements/dependency-injection.md +++ b/docs/framework-elements/dependency-injection.md @@ -1,5 +1,6 @@ --- title: Внедрение зависимостей в поля и функции-сеттеры +order: 50 --- # Внедрение зависимостей в поля и функции-сеттеры diff --git a/docs/framework-elements/instance-generator.md b/docs/framework-elements/instance-generator.md index 35219b1..19cb4f5 100644 --- a/docs/framework-elements/instance-generator.md +++ b/docs/framework-elements/instance-generator.md @@ -1,5 +1,6 @@ --- title: Генератор экземпляров компонентов +order: 70 --- # Генератор экземпляров компонентов diff --git a/docs/framework-elements/launch-control-inversion.md b/docs/framework-elements/launch-control-inversion.md index 186efa9..95b6901 100644 --- a/docs/framework-elements/launch-control-inversion.md +++ b/docs/framework-elements/launch-control-inversion.md @@ -1,5 +1,6 @@ --- title: Инверсия управления запуском приложения +order: 180 --- # Инверсия управления запуском приложения diff --git a/docs/getting-started/10-about-autumn.md b/docs/getting-started/about-autumn.md similarity index 99% rename from docs/getting-started/10-about-autumn.md rename to docs/getting-started/about-autumn.md index ac707e9..0dfbd45 100644 --- a/docs/getting-started/10-about-autumn.md +++ b/docs/getting-started/about-autumn.md @@ -1,5 +1,6 @@ --- title: Что такое Autumn? +order: 10 --- ![autumn](../static/cover.png) diff --git a/docs/getting-started/30-additional-packages.md b/docs/getting-started/additional-packages.md similarity index 99% rename from docs/getting-started/30-additional-packages.md rename to docs/getting-started/additional-packages.md index 87ea43e..ce9c477 100644 --- a/docs/getting-started/30-additional-packages.md +++ b/docs/getting-started/additional-packages.md @@ -1,5 +1,6 @@ --- title: Дополнительные пакеты Autumn +order: 30 --- # Модули и пакеты diff --git a/docs/getting-started/20-first-steps.md b/docs/getting-started/first-steps.md similarity index 99% rename from docs/getting-started/20-first-steps.md rename to docs/getting-started/first-steps.md index 035a370..bf766c3 100644 --- a/docs/getting-started/20-first-steps.md +++ b/docs/getting-started/first-steps.md @@ -1,5 +1,6 @@ --- title: Первое приложение +order: 20 ---