erudit 3.0.0-dev.8 → 4.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +25 -185
- package/app/assets/icons/array-check.svg +3 -0
- package/app/assets/icons/array-lines.svg +3 -0
- package/app/assets/icons/array-star.svg +3 -0
- package/app/assets/icons/arrow/from-circle.svg +3 -0
- package/app/assets/icons/arrow/left.svg +3 -0
- package/app/assets/icons/arrow/outward-box.svg +3 -0
- package/app/assets/icons/arrow/outward.svg +3 -0
- package/app/assets/icons/arrow/to-circle.svg +3 -0
- package/app/assets/icons/arrow/up-to-right.svg +3 -0
- package/app/assets/icons/aside-open.svg +2 -2
- package/app/assets/icons/asterisk.svg +2 -2
- package/app/assets/icons/bell.svg +3 -0
- package/app/assets/icons/book-outline.svg +3 -0
- package/app/assets/icons/book-question.svg +2 -2
- package/app/assets/icons/book.svg +2 -2
- package/app/assets/icons/box.svg +3 -0
- package/app/assets/icons/bug.svg +2 -2
- package/app/assets/icons/chevron-right.svg +3 -0
- package/app/assets/icons/cog.svg +3 -0
- package/app/assets/icons/construction.svg +2 -2
- package/app/assets/icons/diamond.svg +3 -0
- package/app/assets/icons/draw.svg +2 -2
- package/app/assets/icons/erudit.svg +3 -0
- package/app/assets/icons/file-lines.svg +2 -2
- package/app/assets/icons/files.svg +3 -0
- package/app/assets/icons/flame.svg +3 -0
- package/app/assets/icons/folder-open.svg +2 -2
- package/app/assets/icons/folder.svg +2 -2
- package/app/assets/icons/globe.svg +2 -2
- package/app/assets/icons/graduation.svg +3 -0
- package/app/assets/icons/handshake.svg +3 -0
- package/app/assets/icons/house.svg +2 -2
- package/app/assets/icons/lines.svg +3 -0
- package/app/assets/icons/moon.svg +2 -2
- package/app/assets/icons/plus-circle.svg +2 -2
- package/app/assets/icons/plus.svg +2 -2
- package/app/assets/icons/puzzle.svg +2 -2
- package/app/assets/icons/question-circle.svg +3 -0
- package/app/assets/icons/rocket.svg +3 -0
- package/app/assets/icons/search/check.svg +3 -0
- package/app/assets/icons/search/dead.svg +3 -0
- package/app/assets/icons/search/glass.svg +3 -0
- package/app/assets/icons/search/wtf.svg +3 -0
- package/app/assets/icons/sun-moon.svg +2 -2
- package/app/assets/icons/sun.svg +2 -2
- package/app/assets/icons/translate.svg +3 -0
- package/app/assets/icons/user.svg +2 -2
- package/app/assets/icons/users.svg +2 -2
- package/app/assets/icons/warning.svg +3 -0
- package/app/components/EruditLink.ts +9 -0
- package/app/components/FancyBold.vue +17 -0
- package/app/components/FancyCard.vue +59 -0
- package/app/components/FancyCardTag.vue +16 -0
- package/app/components/Prose.vue +51 -0
- package/app/components/ScrollHolder.vue +20 -0
- package/app/components/SmartMedia.vue +112 -0
- package/app/components/ads/Ads.vue +39 -0
- package/app/components/ads/AdsBannerAside.vue +46 -0
- package/app/components/ads/AdsBannerBottom.vue +17 -0
- package/app/components/ads/AdsReplacer.vue +28 -0
- package/app/components/ads/provider/Custom.vue +19 -0
- package/app/components/ads/provider/Yandex.vue +84 -0
- package/app/components/aside/AsideListItem.vue +66 -74
- package/app/components/aside/AsideMajor.vue +8 -56
- package/app/components/aside/AsideMinor.vue +76 -71
- package/app/components/aside/AsidePlainMessage.vue +9 -0
- package/app/components/aside/AsideSwitch.vue +67 -0
- package/app/components/aside/major/PaneHolder.vue +106 -0
- package/app/components/aside/major/PaneSwitcher.vue +73 -0
- package/app/components/aside/major/PaneSwitcherButton.vue +38 -0
- package/app/components/aside/major/PaneTemplate.vue +5 -0
- package/app/components/aside/major/SiteInfo.vue +68 -85
- package/app/components/aside/major/contentNav/PaneBookNav.vue +116 -0
- package/app/components/aside/major/contentNav/PaneGlobalNav.vue +19 -0
- package/app/components/aside/major/contentNav/items/ContentNavBook.vue +21 -0
- package/app/components/aside/major/contentNav/items/ContentNavFolder.vue +92 -0
- package/app/components/aside/major/contentNav/items/ContentNavItem.vue +33 -0
- package/app/components/aside/major/contentNav/items/ContentNavPage.vue +18 -0
- package/app/components/aside/major/contentNav/items/ContentNavSeparator.vue +62 -0
- package/app/components/aside/major/contentNav/items/ContentNavTopic.vue +18 -0
- package/app/components/aside/major/contentNav/items/Flags.vue +52 -0
- package/app/components/aside/major/contentNav/items/ItemTemplate.vue +27 -0
- package/app/components/aside/major/languages/PaneLanguages.vue +55 -0
- package/app/components/aside/major/pages/PanePages.vue +60 -0
- package/app/components/aside/major/search/PaneSearch.vue +145 -0
- package/app/components/aside/major/search/SearchInput.vue +104 -0
- package/app/components/aside/major/search/SearchResult.vue +103 -0
- package/app/components/aside/major/search/SearchStatus.vue +48 -0
- package/app/components/aside/major/search/search.worker.ts +164 -0
- package/app/components/aside/major/settings/BuildTime.vue +25 -0
- package/app/components/aside/major/settings/EngineVersion.vue +13 -0
- package/app/components/aside/major/settings/PaneSettings.vue +17 -0
- package/app/components/aside/major/settings/ThemeSwitcher.vue +53 -0
- package/app/components/aside/major/settings/repository/Repository.vue +33 -0
- package/app/components/aside/major/settings/repository/SecondaryGitHub.vue +71 -0
- package/app/components/aside/minor/AsideMinorPane.vue +1 -11
- package/app/components/aside/minor/AsideMinorPlainHeader.vue +21 -0
- package/app/components/aside/minor/content/AsideMinorContentContributions.vue +51 -0
- package/app/components/aside/minor/content/AsideMinorContentPage.vue +37 -0
- package/app/components/aside/minor/content/AsideMinorContentTopic.vue +69 -0
- package/app/components/aside/minor/content/ButtonPaneContributions.vue +116 -0
- package/app/components/aside/minor/content/ButtonPaneImprove.vue +121 -0
- package/app/components/aside/minor/content/Contribution.vue +36 -0
- package/app/components/aside/minor/content/Toc.vue +163 -0
- package/app/components/aside/minor/content/TocItem.vue +77 -0
- package/app/components/aside/minor/content/TopicPartButton.vue +35 -0
- package/app/components/aside/minor/contributor/AsideMinorContributor.vue +39 -0
- package/app/components/aside/minor/contributor/ItemBook.vue +39 -0
- package/app/components/aside/minor/contributor/ItemContent.vue +17 -0
- package/app/components/aside/minor/news/AsideMinorNews.vue +133 -0
- package/app/components/aside/minor/news/NewsItem.vue +69 -0
- package/app/components/aside/minor/news/RenderNewsElement.vue +42 -0
- package/app/components/aside/minor/news/elements/Mix.vue +11 -0
- package/app/components/aside/minor/news/elements/P.vue +14 -0
- package/app/components/aside/minor/news/elements/Ref.vue +58 -0
- package/app/components/aside/minor/news/elements/Text.vue +18 -0
- package/app/components/indexPage/IndexPagePersons.vue +117 -0
- package/app/components/main/MainAction.vue +20 -0
- package/app/components/main/MainBreadcrumbs.vue +28 -0
- package/app/components/main/MainContentChild.vue +48 -0
- package/app/components/main/MainContentChildren.vue +14 -0
- package/app/components/main/MainDecoration.vue +15 -0
- package/app/components/main/MainDescription.vue +13 -0
- package/app/components/main/MainFlag.vue +133 -0
- package/app/components/main/MainFlags.vue +17 -0
- package/app/components/main/MainGlow.vue +12 -0
- package/app/components/main/MainQuickLink.vue +76 -0
- package/app/components/main/MainQuickLinks.vue +42 -0
- package/app/components/main/MainQuote.vue +162 -0
- package/app/components/main/MainQuoteLoader.vue +86 -0
- package/app/components/main/MainSection.vue +59 -0
- package/app/components/main/MainSectionPreamble.vue +5 -0
- package/app/components/main/MainSubTitle.vue +12 -0
- package/app/components/main/MainTitle.vue +33 -0
- package/app/components/main/MainTopicPartPage.vue +88 -0
- package/app/components/main/MainTopicPartSwitch.vue +71 -0
- package/app/components/main/connections/Deps.vue +34 -0
- package/app/components/main/connections/Externals.vue +46 -0
- package/app/components/main/connections/MainConnections.vue +41 -0
- package/app/components/main/connections/MainConnectionsButton.vue +80 -0
- package/app/components/main/connections/ScrollPane.vue +11 -0
- package/app/components/main/contentStats/Item.vue +35 -0
- package/app/components/main/contentStats/ItemElement.vue +19 -0
- package/app/components/main/contentStats/ItemMaterials.vue +11 -0
- package/app/components/main/contentStats/MainContentStats.vue +50 -0
- package/app/components/preview/Preview.vue +173 -186
- package/app/components/preview/PreviewError.vue +10 -0
- package/app/components/preview/PreviewLoading.vue +5 -14
- package/app/components/preview/PreviewScreen.vue +65 -141
- package/app/components/preview/PreviewScreenButton.vue +39 -0
- package/app/components/preview/screen/ContentPage.vue +50 -0
- package/app/components/preview/screen/DirectLink.vue +23 -0
- package/app/components/preview/screen/Unique.vue +54 -0
- package/app/components/site/SiteAside.vue +70 -0
- package/app/components/site/SiteAsideOverlay.vue +21 -0
- package/app/components/site/SiteMain.vue +16 -0
- package/app/components/transition/Fade.vue +30 -19
- package/app/components/transition/Slide.vue +47 -0
- package/app/components/tree/TreeContainer.vue +5 -11
- package/app/components/tree/TreeItem.vue +40 -89
- package/app/composables/ads.ts +23 -0
- package/app/composables/analytics.ts +102 -0
- package/app/composables/appElements.ts +40 -0
- package/app/composables/aside.ts +28 -0
- package/app/composables/asideMajorPane.ts +135 -0
- package/app/composables/asideMinor.ts +109 -0
- package/app/composables/contentNav.ts +7 -0
- package/app/composables/favicon.ts +104 -4
- package/app/composables/file.ts +3 -0
- package/app/composables/formatText.ts +85 -71
- package/app/composables/loading.ts +2 -0
- package/app/composables/mainContent.ts +31 -0
- package/app/composables/og.ts +165 -0
- package/app/composables/phrases.ts +126 -81
- package/app/composables/preview.ts +53 -0
- package/app/composables/route.ts +4 -0
- package/app/composables/theme.ts +71 -29
- package/app/composables/url.ts +22 -33
- package/app/formatters/ru.ts +14 -0
- package/app/pages/article/[...articleId].vue +10 -1
- package/app/pages/book/[...bookId].vue +52 -43
- package/app/pages/contributor/[contributorId].vue +151 -0
- package/app/pages/contributors.vue +99 -0
- package/app/pages/group/[...groupId].vue +53 -59
- package/app/pages/index.vue +114 -26
- package/app/pages/page/[...pageId].vue +60 -0
- package/app/pages/practice/[...practiceId].vue +12 -0
- package/app/pages/sponsors.vue +91 -0
- package/app/pages/summary/[...summaryId].vue +10 -1
- package/app/plugins/appSetup/client/htmlBranding.ts +6 -0
- package/app/plugins/appSetup/client/welcome.ts +35 -0
- package/app/plugins/appSetup/config.ts +6 -0
- package/app/plugins/appSetup/global.ts +3 -0
- package/app/plugins/appSetup/index.ts +28 -0
- package/app/plugins/prerender.server.ts +40 -0
- package/app/router.options.ts +5 -0
- package/app/scripts/theme.js +33 -0
- package/app/styles/main.css +173 -0
- package/bin/erudit.mjs +2 -2
- package/modules/erudit/globals/content.ts +4 -0
- package/modules/erudit/globals/contributor.ts +1 -0
- package/modules/erudit/globals/eruditConfig.ts +10 -0
- package/modules/erudit/globals/problem.ts +1 -0
- package/modules/erudit/globals/prose.ts +1 -0
- package/modules/erudit/globals/public.ts +18 -0
- package/modules/erudit/index.ts +60 -0
- package/{module → modules/erudit}/logger.ts +2 -2
- package/modules/erudit/setup/aliases.ts +17 -0
- package/modules/erudit/setup/baseUrl.ts +19 -0
- package/modules/erudit/setup/elements/appTemplate.ts +45 -0
- package/modules/erudit/setup/elements/globalTemplate.ts +82 -0
- package/modules/erudit/setup/elements/globalTypes.ts +273 -0
- package/modules/erudit/setup/elements/setup.ts +167 -0
- package/modules/erudit/setup/elements/shared.ts +10 -0
- package/modules/erudit/setup/elements/tagsTable.ts +28 -0
- package/modules/erudit/setup/fullRestart.ts +71 -0
- package/modules/erudit/setup/globals.ts +196 -0
- package/modules/erudit/setup/nuxtConfig.ts +62 -0
- package/modules/erudit/setup/projectConfig.ts +114 -0
- package/modules/erudit/setup/publicAssets.ts +52 -0
- package/modules/erudit/setup/runtimeConfig.ts +58 -0
- package/modules/erudit/watcher.ts +27 -0
- package/nuxt.config.ts +66 -87
- package/package.json +38 -19
- package/proxy/prose.app.ts +1 -0
- package/proxy/prose.ts +1 -0
- package/public/favicons/default.svg +1 -0
- package/{app/public → public}/logotype.svg +1 -1
- package/public/og.png +0 -0
- package/server/api/aside/major/frontNav/book/[...shortId].ts +10 -0
- package/server/api/aside/major/frontNav/global.ts +5 -0
- package/server/api/aside/major/pages.ts +6 -0
- package/server/api/contributor/list.ts +61 -0
- package/server/api/contributor/page/[contributorId].ts +68 -0
- package/server/api/indexPage.ts +81 -0
- package/server/api/language/functions.ts +6 -7
- package/server/api/language/phrase/[phraseKey].ts +32 -0
- package/server/api/main/content/[...contentTypePath].ts +153 -0
- package/server/api/news/batch/[batchIndex].ts +5 -0
- package/server/api/pageSponsors.ts +58 -0
- package/server/api/prerender/content.ts +82 -0
- package/server/api/prerender/default.ts +35 -0
- package/server/api/prerender/files.ts +10 -0
- package/server/api/prerender/frontNav.ts +13 -0
- package/server/api/prerender/language.ts +7 -0
- package/server/api/prerender/news.ts +8 -0
- package/server/api/prerender/quotes.ts +15 -0
- package/server/api/preview/contentPage/[...contentTypePath].ts +63 -0
- package/server/api/preview/contentUnique/[...contentTypePathUnique].ts +81 -0
- package/server/api/problemScript/[...problemScriptPath].ts +92 -0
- package/server/api/quote/data/[quoteId].ts +87 -0
- package/server/api/quote/ids.ts +3 -0
- package/server/erudit/build.ts +137 -0
- package/server/erudit/cameos/build.ts +111 -0
- package/server/erudit/config.ts +13 -0
- package/server/erudit/content/global/build.ts +271 -0
- package/server/erudit/content/global/singleton.ts +5 -0
- package/server/erudit/content/nav/build.ts +431 -0
- package/server/erudit/content/nav/front.ts +127 -0
- package/server/erudit/content/nav/repository/books.ts +40 -0
- package/server/erudit/content/nav/repository/get.ts +33 -0
- package/server/erudit/content/nav/repository/hasChildren.ts +5 -0
- package/server/erudit/content/nav/repository/hasNav.ts +3 -0
- package/server/erudit/content/nav/repository/hasParent.ts +5 -0
- package/server/erudit/content/nav/repository/id.ts +9 -0
- package/server/erudit/content/nav/repository/index.ts +9 -0
- package/server/erudit/content/nav/repository/order.ts +14 -0
- package/server/erudit/content/nav/repository/previousNext.ts +35 -0
- package/server/erudit/content/nav/repository/walk.ts +127 -0
- package/server/erudit/content/nav/setup.ts +13 -0
- package/server/erudit/content/nav/types.ts +24 -0
- package/server/erudit/content/repository/breadcrumbs.ts +24 -0
- package/server/erudit/content/repository/children.ts +47 -0
- package/server/erudit/content/repository/connections.ts +35 -0
- package/server/erudit/content/repository/contentLink.ts +16 -0
- package/server/erudit/content/repository/decoration.ts +23 -0
- package/server/erudit/content/repository/deps.ts +84 -0
- package/server/erudit/content/repository/description.ts +11 -0
- package/server/erudit/content/repository/elementSnippets.ts +65 -0
- package/server/erudit/content/repository/externals.ts +21 -0
- package/server/erudit/content/repository/flags.ts +33 -0
- package/server/erudit/content/repository/seo.ts +12 -0
- package/server/erudit/content/repository/stats.ts +97 -0
- package/server/erudit/content/repository/title.ts +27 -0
- package/server/erudit/content/repository/topicParts.ts +39 -0
- package/server/erudit/content/repository/unique.ts +76 -0
- package/server/erudit/content/resolve/book.ts +32 -0
- package/server/erudit/content/resolve/group.ts +39 -0
- package/server/erudit/content/resolve/index.ts +139 -0
- package/server/erudit/content/resolve/page.ts +87 -0
- package/server/erudit/content/resolve/topic.ts +185 -0
- package/server/erudit/content/resolve/utils/contentError.ts +10 -0
- package/server/erudit/content/resolve/utils/insertContentItem.ts +122 -0
- package/server/erudit/content/resolve/utils/insertContentResolved.ts +93 -0
- package/server/erudit/content/search.ts +135 -0
- package/server/erudit/contributors/build.ts +111 -0
- package/server/erudit/contributors/global.ts +3 -0
- package/server/erudit/contributors/repository/avatarUrl.ts +10 -0
- package/server/erudit/contributors/repository/contributions.ts +178 -0
- package/server/erudit/contributors/repository/count.ts +3 -0
- package/server/erudit/contributors/search.ts +34 -0
- package/server/erudit/db/repository/pushFile.ts +23 -0
- package/server/erudit/db/repository/pushProblemScript.ts +19 -0
- package/server/erudit/db/repository/pushProseLink.ts +40 -0
- package/server/erudit/db/schema/cameos.ts +7 -0
- package/server/erudit/db/schema/content.ts +18 -0
- package/server/erudit/db/schema/contentContributions.ts +15 -0
- package/server/erudit/db/schema/contentDeps.ts +21 -0
- package/server/erudit/db/schema/contentElementStats.ts +20 -0
- package/server/erudit/db/schema/contentProseLinks.ts +23 -0
- package/server/erudit/db/schema/contentSnippets.ts +16 -0
- package/server/erudit/db/schema/contentToc.ts +16 -0
- package/server/erudit/db/schema/contentUniques.ts +25 -0
- package/server/erudit/db/schema/contributors.ts +12 -0
- package/server/erudit/db/schema/files.ts +11 -0
- package/server/erudit/db/schema/groups.ts +6 -0
- package/server/erudit/db/schema/index.ts +17 -0
- package/server/erudit/db/schema/news.ts +7 -0
- package/server/erudit/db/schema/pages.ts +7 -0
- package/server/erudit/db/schema/problemScripts.ts +14 -0
- package/server/erudit/db/schema/sponsors.ts +9 -0
- package/server/erudit/db/schema/topics.ts +9 -0
- package/server/erudit/db/setup.ts +62 -0
- package/server/erudit/db/types.ts +10 -0
- package/server/erudit/global.ts +33 -0
- package/server/erudit/importer.ts +97 -0
- package/server/erudit/index.ts +90 -0
- package/server/erudit/language/list/en.ts +209 -0
- package/server/erudit/language/list/ru.ts +214 -0
- package/server/erudit/language/list.ts +6 -0
- package/server/erudit/language/setup.ts +36 -0
- package/server/erudit/language/types.ts +16 -0
- package/server/erudit/logger.ts +77 -0
- package/server/erudit/news/build.ts +77 -0
- package/server/erudit/news/repository/batch.ts +61 -0
- package/server/erudit/prose/repository/finalize.ts +68 -0
- package/server/erudit/prose/repository/get.ts +54 -0
- package/server/erudit/prose/repository/resolve.ts +17 -0
- package/server/erudit/prose/storage/callout.ts +14 -0
- package/server/erudit/prose/storage/image.ts +20 -0
- package/server/erudit/prose/storage/link.ts +226 -0
- package/server/erudit/prose/storage/problemScript.ts +21 -0
- package/server/erudit/prose/storage/video.ts +14 -0
- package/server/erudit/prose/transform/bundleProblemScript.ts +6 -0
- package/server/erudit/prose/transform/extensions.ts +15 -0
- package/server/erudit/quote/repository/ids.ts +31 -0
- package/server/erudit/repository.ts +96 -0
- package/server/erudit/sponsors/build.ts +114 -0
- package/server/erudit/sponsors/repository/avatarUrl.ts +10 -0
- package/server/erudit/sponsors/repository/count.ts +4 -0
- package/server/erudit/staticFile.ts +28 -0
- package/server/plugins/augmentCss.ts +17 -0
- package/server/plugins/lang.ts +7 -0
- package/server/plugins/metaViewport.ts +15 -0
- package/server/plugins/theme.ts +13 -0
- package/server/routes/file/[...path].ts +18 -0
- package/server/routes/robots.txt.ts +9 -0
- package/server/routes/search.json.gz.ts +73 -0
- package/server/routes/sitemap.xml.ts +81 -0
- package/shared/search/encoders.ts +20 -0
- package/shared/types/asideMajorPages.ts +4 -0
- package/shared/types/breadcrumbs.ts +9 -0
- package/shared/types/contentChildren.ts +10 -0
- package/shared/types/contentConnections.ts +27 -0
- package/shared/types/contentStats.ts +6 -0
- package/shared/types/elementSnippet.ts +8 -0
- package/shared/types/frontContentNav.ts +38 -0
- package/shared/types/indexPage.ts +20 -0
- package/shared/types/language.ts +189 -75
- package/shared/types/mainContent.ts +69 -0
- package/shared/types/news.ts +13 -0
- package/shared/types/preview.ts +28 -0
- package/shared/types/runtimeConfig.ts +64 -0
- package/shared/types/search.ts +79 -0
- package/shared/utils/contentTypePath.ts +63 -0
- package/shared/utils/icons.ts +11 -0
- package/shared/utils/pages.ts +24 -0
- package/shared/utils/slasher.ts +64 -0
- package/shared/utils/stringColor.ts +13 -9
- package/shared/utils/toStringEqual.ts +21 -0
- package/shared/utils/zip.ts +64 -0
- package/test/shared/utils/slasher.test.ts +75 -0
- package/test/shared/utils/zip.test.ts +8 -0
- package/tsconfig.json +17 -8
- package/app/assets/icons/alert.svg +0 -3
- package/app/assets/icons/angle-right.svg +0 -3
- package/app/assets/icons/arrow-in-text.svg +0 -3
- package/app/assets/icons/arrow-left.svg +0 -3
- package/app/assets/icons/arrow-up-to-right.svg +0 -3
- package/app/assets/icons/chip.svg +0 -3
- package/app/assets/icons/circle-help.svg +0 -3
- package/app/assets/icons/cross.svg +0 -3
- package/app/assets/icons/ellipsis-vertical.svg +0 -3
- package/app/assets/icons/file-check.svg +0 -3
- package/app/assets/icons/file-star.svg +0 -3
- package/app/assets/icons/link-external.svg +0 -3
- package/app/assets/icons/link.svg +0 -3
- package/app/assets/icons/outline/book.svg +0 -3
- package/app/assets/icons/outline/file-lines.svg +0 -3
- package/app/assets/icons/pirate.svg +0 -3
- package/app/assets/icons/search.svg +0 -3
- package/app/assets/icons/shuffle.svg +0 -3
- package/app/assets/icons/star.svg +0 -3
- package/app/components/Loading.vue +0 -23
- package/app/components/SiteAside.vue +0 -393
- package/app/components/SiteMain.vue +0 -34
- package/app/components/ads/BannerTemplate.vue +0 -51
- package/app/components/ads/BottomBanner.vue +0 -45
- package/app/components/ads/LeftBanner.vue +0 -50
- package/app/components/aside/major/PaneContentScroll.vue +0 -23
- package/app/components/aside/major/PaneSwitch.vue +0 -54
- package/app/components/aside/major/PaneSwitchButton.vue +0 -63
- package/app/components/aside/major/panes/Language.vue +0 -79
- package/app/components/aside/major/panes/Pages.vue +0 -34
- package/app/components/aside/major/panes/Search.vue +0 -11
- package/app/components/aside/major/panes/nav/Nav.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBook.vue +0 -87
- package/app/components/aside/major/panes/nav/NavBookLoading.vue +0 -24
- package/app/components/aside/major/panes/nav/NavGlobal.vue +0 -16
- package/app/components/aside/major/panes/nav/fnav/FNav.vue +0 -105
- package/app/components/aside/major/panes/nav/fnav/FNavBook.vue +0 -32
- package/app/components/aside/major/panes/nav/fnav/FNavFlags.vue +0 -40
- package/app/components/aside/major/panes/nav/fnav/FNavFolder.vue +0 -60
- package/app/components/aside/major/panes/nav/fnav/FNavItem.vue +0 -34
- package/app/components/aside/major/panes/nav/fnav/FNavSeparator.vue +0 -80
- package/app/components/aside/major/panes/nav/fnav/FNavTopic.vue +0 -24
- package/app/components/aside/major/panes/other/ItemContent.vue +0 -29
- package/app/components/aside/major/panes/other/ItemGenerator.vue +0 -15
- package/app/components/aside/major/panes/other/ItemTheme.vue +0 -54
- package/app/components/aside/major/panes/other/Other.vue +0 -16
- package/app/components/aside/minor/AsideMinorContributor.vue +0 -5
- package/app/components/aside/minor/AsideMinorNews.vue +0 -11
- package/app/components/aside/minor/AsideMinorTopLink.vue +0 -67
- package/app/components/aside/minor/Contribute.vue +0 -145
- package/app/components/aside/minor/content/AsideMinorContent.vue +0 -92
- package/app/components/aside/minor/topic/AsideMinorTopic.vue +0 -32
- package/app/components/aside/minor/topic/TopicContributors.vue +0 -177
- package/app/components/aside/minor/topic/TopicNav.vue +0 -49
- package/app/components/aside/minor/topic/TopicToc.vue +0 -219
- package/app/components/aside/minor/topic/TopicTocItem.vue +0 -30
- package/app/components/aside/utils/AsideOverlayPane.vue +0 -40
- package/app/components/bitran/BitranContent.vue +0 -77
- package/app/components/bitran/RenderWrapper.vue +0 -10
- package/app/components/contributor/ContributorAvatar.vue +0 -43
- package/app/components/contributor/ContributorListItem.vue +0 -35
- package/app/components/main/topic/MainTopic.vue +0 -78
- package/app/components/main/topic/TopicPartSwitch.vue +0 -118
- package/app/components/main/utils/Breadcrumb.vue +0 -70
- package/app/components/main/utils/ContentDecoration.vue +0 -29
- package/app/components/main/utils/ContentDescription.vue +0 -19
- package/app/components/main/utils/ContentPopover.vue +0 -188
- package/app/components/main/utils/ContentPopovers.vue +0 -111
- package/app/components/main/utils/ContentReferences.vue +0 -70
- package/app/components/main/utils/ContentSection.vue +0 -45
- package/app/components/main/utils/ContentTitle.vue +0 -63
- package/app/components/main/utils/reference/ReferenceGroup.vue +0 -38
- package/app/components/main/utils/reference/ReferenceItem.vue +0 -68
- package/app/components/main/utils/reference/ReferenceSource.vue +0 -116
- package/app/components/preview/PreviewDisplay.vue +0 -139
- package/app/components/preview/PreviewFooterAction.vue +0 -73
- package/app/components/preview/display/Alert.vue +0 -50
- package/app/components/preview/display/Custom.vue +0 -18
- package/app/components/preview/display/GenericLink.vue +0 -48
- package/app/components/preview/display/PageLink.vue +0 -20
- package/app/components/preview/display/Unique.vue +0 -55
- package/app/composables/bitran.ts +0 -105
- package/app/composables/bitranContent.ts +0 -51
- package/app/composables/bitranLocation.ts +0 -7
- package/app/composables/contentData.ts +0 -36
- package/app/composables/contentPage.ts +0 -157
- package/app/composables/contentRoute.ts +0 -45
- package/app/composables/darkMagic.ts +0 -24
- package/app/composables/externalApi.ts +0 -63
- package/app/composables/majorPane.ts +0 -60
- package/app/pages/_test/preview.vue +0 -110
- package/app/pages/members.vue +0 -6
- package/app/pages/practice/[...practice].vue +0 -3
- package/app/public/favicon/article.svg +0 -10
- package/app/public/favicon/default.svg +0 -10
- package/app/public/favicon/practice.svg +0 -10
- package/app/public/favicon/summary.svg +0 -10
- package/app/public/og-default.png +0 -0
- package/app/public/user.svg +0 -10
- package/app/scripts/_immediate.js +0 -9
- package/app/scripts/aside/index.ts +0 -59
- package/app/scripts/aside/major/nav.ts +0 -26
- package/app/scripts/aside/minor/state.ts +0 -37
- package/app/scripts/aside/minor/topic.ts +0 -3
- package/app/scripts/flag.ts +0 -28
- package/app/scripts/og.ts +0 -27
- package/app/scripts/preview/build.ts +0 -73
- package/app/scripts/preview/data/alert.ts +0 -19
- package/app/scripts/preview/data/custom.ts +0 -8
- package/app/scripts/preview/data/genericLink.ts +0 -24
- package/app/scripts/preview/data/pageLink.ts +0 -22
- package/app/scripts/preview/data/unique.ts +0 -72
- package/app/scripts/preview/data.ts +0 -24
- package/app/scripts/preview/display.ts +0 -37
- package/app/scripts/preview/footer.ts +0 -9
- package/app/scripts/preview/request.ts +0 -51
- package/app/scripts/preview/state.ts +0 -63
- package/app/styles/_immediate.css +0 -7
- package/app/styles/_util.scss +0 -43
- package/app/styles/_utils.scss +0 -44
- package/app/styles/app.scss +0 -91
- package/app/styles/def/_bp.scss +0 -27
- package/app/styles/def/_size.scss +0 -7
- package/app/styles/def/_z.scss +0 -5
- package/app/styles/normalize.scss +0 -63
- package/app/styles/partials/_darkMagic.scss +0 -5
- package/app/styles/partials/_fnav.scss +0 -15
- package/app/styles/partials/_preview.scss +0 -5
- package/globalPath.ts +0 -21
- package/globals/bitran.ts +0 -2
- package/globals/content.ts +0 -22
- package/globals/contributor.ts +0 -5
- package/globals/erudit.ts +0 -5
- package/globals/register.ts +0 -18
- package/languages/en.ts +0 -95
- package/languages/ru.ts +0 -99
- package/module/bitran.ts +0 -36
- package/module/config.ts +0 -35
- package/module/imports.ts +0 -50
- package/module/index.ts +0 -47
- package/module/paths.ts +0 -22
- package/module/restart.ts +0 -61
- package/server/api/aside/major/nav/bookIds.ts +0 -5
- package/server/api/aside/major/nav/bookNav/[...bookId].ts +0 -20
- package/server/api/aside/major/nav/global.ts +0 -7
- package/server/api/aside/minor/news.ts +0 -7
- package/server/api/aside/minor/path.ts +0 -77
- package/server/api/bitran/content/[location].ts +0 -8
- package/server/api/bitran/toc/[location].ts +0 -7
- package/server/api/content/data.ts +0 -72
- package/server/api/contributor/count.ts +0 -6
- package/server/api/fake/content.ts +0 -11
- package/server/api/fake/shared/languages.ts +0 -12
- package/server/api/language/phrase/[phraseId].ts +0 -19
- package/server/api/language/phraseIds.ts +0 -8
- package/server/api/preview/page/[...parts].ts +0 -52
- package/server/api/preview/unique/[location].ts +0 -60
- package/server/plugin/bitran/content.ts +0 -194
- package/server/plugin/bitran/location.ts +0 -25
- package/server/plugin/bitran/products/include.ts +0 -228
- package/server/plugin/bitran/products/link.ts +0 -116
- package/server/plugin/bitran/setup.ts +0 -11
- package/server/plugin/bitran/toc.ts +0 -75
- package/server/plugin/bitran/transpiler.ts +0 -30
- package/server/plugin/build/close.ts +0 -10
- package/server/plugin/build/jobs/content/builderArgs.ts +0 -8
- package/server/plugin/build/jobs/content/generic.ts +0 -176
- package/server/plugin/build/jobs/content/parse.ts +0 -109
- package/server/plugin/build/jobs/content/path.ts +0 -6
- package/server/plugin/build/jobs/content/type/book.ts +0 -9
- package/server/plugin/build/jobs/content/type/group.ts +0 -37
- package/server/plugin/build/jobs/content/type/topic.ts +0 -36
- package/server/plugin/build/jobs/contributors.ts +0 -66
- package/server/plugin/build/jobs/language.ts +0 -36
- package/server/plugin/build/jobs/nav.ts +0 -214
- package/server/plugin/build/process.ts +0 -25
- package/server/plugin/build/rebuild.ts +0 -55
- package/server/plugin/build/setup.ts +0 -22
- package/server/plugin/content/absoluteId.ts +0 -94
- package/server/plugin/content/context.ts +0 -116
- package/server/plugin/db/entities/Book.ts +0 -7
- package/server/plugin/db/entities/Content.ts +0 -49
- package/server/plugin/db/entities/Contribution.ts +0 -10
- package/server/plugin/db/entities/Contributor.ts +0 -16
- package/server/plugin/db/entities/Group.ts +0 -14
- package/server/plugin/db/entities/Hash.ts +0 -15
- package/server/plugin/db/entities/Topic.ts +0 -20
- package/server/plugin/db/entities/Unique.ts +0 -21
- package/server/plugin/db/setup.ts +0 -34
- package/server/plugin/global.ts +0 -17
- package/server/plugin/importer.ts +0 -12
- package/server/plugin/index.ts +0 -9
- package/server/plugin/logger.ts +0 -23
- package/server/plugin/nav/node.ts +0 -26
- package/server/plugin/nav/utils.ts +0 -129
- package/server/plugin/repository/book.ts +0 -21
- package/server/plugin/repository/content.ts +0 -238
- package/server/plugin/repository/contributor.ts +0 -8
- package/server/plugin/repository/frontNav.ts +0 -148
- package/server/plugin/repository/topic.ts +0 -32
- package/server/tsconfig.json +0 -9
- package/shared/aside/minor.ts +0 -51
- package/shared/asset.ts +0 -15
- package/shared/bitran/stringContent.ts +0 -6
- package/shared/bitran/toc.ts +0 -8
- package/shared/content/context.ts +0 -9
- package/shared/content/data/base.ts +0 -32
- package/shared/content/data/index.ts +0 -5
- package/shared/content/data/type/book.ts +0 -5
- package/shared/content/data/type/group.ts +0 -6
- package/shared/content/data/type/topic.ts +0 -11
- package/shared/content/previousNext.ts +0 -9
- package/shared/contributor.ts +0 -5
- package/shared/frontNav.ts +0 -41
- package/shared/icons.ts +0 -38
- package/shared/image.ts +0 -5
- package/shared/link.ts +0 -28
- package/shared/popover.ts +0 -8
- package/shared/utils/objectsEqual.ts +0 -4
- package/utils/stress.ts +0 -9
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
decodeBitranLocation,
|
|
3
|
-
parseBitranLocation,
|
|
4
|
-
} from '@erudit-js/cog/schema';
|
|
5
|
-
|
|
6
|
-
export function parseUrlLocation(urlLocation: string) {
|
|
7
|
-
urlLocation = decodeURIComponent(urlLocation);
|
|
8
|
-
urlLocation = decodeBitranLocation(urlLocation);
|
|
9
|
-
|
|
10
|
-
if (!urlLocation)
|
|
11
|
-
throw createError({
|
|
12
|
-
statusCode: 500,
|
|
13
|
-
statusText: 'Empty content location router parameter!',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
return parseBitranLocation(urlLocation);
|
|
18
|
-
} catch (error: any) {
|
|
19
|
-
throw createError({
|
|
20
|
-
statusCode: 404,
|
|
21
|
-
statusText:
|
|
22
|
-
error?.message || `Can't parse location "${urlLocation}"!`,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { BlockNode, type ElementNode } from '@bitran-js/core';
|
|
2
|
-
import type { BitranTranspiler } from '@bitran-js/transpiler';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
parseBitranLocation,
|
|
6
|
-
parsePartialBitranLocation,
|
|
7
|
-
stringifyBitranLocation,
|
|
8
|
-
tryReplaceAlias,
|
|
9
|
-
type BitranAliases,
|
|
10
|
-
type BitranContext,
|
|
11
|
-
} from '@erudit-js/cog/schema';
|
|
12
|
-
import { IncludeNode } from '@erudit-js/bitran-elements/include/shared';
|
|
13
|
-
import { AliasesNode } from '@erudit-js/bitran-elements/aliases/shared';
|
|
14
|
-
import { LinkNode } from '@erudit-js/bitran-elements/link/shared';
|
|
15
|
-
import { createLinkTarget } from '@erudit-js/bitran-elements/link/target';
|
|
16
|
-
|
|
17
|
-
import { createBitranTranspiler } from '@server/bitran/transpiler';
|
|
18
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
19
|
-
import { DbUnique } from '@server/db/entities/Unique';
|
|
20
|
-
import {
|
|
21
|
-
toAbsoluteContentId,
|
|
22
|
-
toAbsoluteContentLocation,
|
|
23
|
-
} from '@server/content/absoluteId';
|
|
24
|
-
|
|
25
|
-
export type TraverseEnterFn = (payload: {
|
|
26
|
-
_location: string;
|
|
27
|
-
_bitranTranspiler: BitranTranspiler;
|
|
28
|
-
_biCode: string;
|
|
29
|
-
}) => Promise<any>;
|
|
30
|
-
|
|
31
|
-
export type TraverseStepFn = (payload: {
|
|
32
|
-
_location: string;
|
|
33
|
-
_bitranTranspiler: BitranTranspiler;
|
|
34
|
-
_node: ElementNode;
|
|
35
|
-
}) => Promise<any>;
|
|
36
|
-
|
|
37
|
-
export type TraverseLeaveFn = (payload: { _location: string }) => Promise<any>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* This operation is heavy as fuck.
|
|
41
|
-
* It consumes a lot of memory and is slow.
|
|
42
|
-
* Use as rarely as possible!
|
|
43
|
-
*/
|
|
44
|
-
export async function traverseInclude(
|
|
45
|
-
includeNode: IncludeNode,
|
|
46
|
-
context: BitranContext,
|
|
47
|
-
listeners: {
|
|
48
|
-
enter?: TraverseEnterFn;
|
|
49
|
-
step?: TraverseStepFn;
|
|
50
|
-
leave?: TraverseLeaveFn;
|
|
51
|
-
},
|
|
52
|
-
) {
|
|
53
|
-
const entryLocation = stringifyBitranLocation(
|
|
54
|
-
parsePartialBitranLocation(includeNode.id, context.location),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const travelMap: Record<string, string | null> = {
|
|
58
|
-
// Not displayed when error, but needed for checking infinite loops
|
|
59
|
-
[entryLocation]: null,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
await _traverseStep(
|
|
64
|
-
includeNode,
|
|
65
|
-
entryLocation,
|
|
66
|
-
context.aliases,
|
|
67
|
-
listeners,
|
|
68
|
-
travelMap,
|
|
69
|
-
);
|
|
70
|
-
} catch (message) {
|
|
71
|
-
let finalMessage = `Include Traversal Error!\n\n${message}\n\n`;
|
|
72
|
-
|
|
73
|
-
for (const [location, includeTarget] of Object.entries(
|
|
74
|
-
travelMap,
|
|
75
|
-
).reverse()) {
|
|
76
|
-
if (includeTarget === null) continue;
|
|
77
|
-
|
|
78
|
-
finalMessage += `at "${printIncludeTarget(includeTarget)}" in "${location}"\n`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
throw new Error(finalMessage);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async function _traverseStep(
|
|
86
|
-
includeNode: IncludeNode,
|
|
87
|
-
location: string,
|
|
88
|
-
aliases: BitranAliases,
|
|
89
|
-
listeners: {
|
|
90
|
-
enter?: TraverseEnterFn;
|
|
91
|
-
step?: TraverseStepFn;
|
|
92
|
-
leave?: TraverseLeaveFn;
|
|
93
|
-
},
|
|
94
|
-
travelMap: Record<string, string | null>,
|
|
95
|
-
) {
|
|
96
|
-
let includeTargetLocation: string;
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
const parsedLocation = parseBitranLocation(location);
|
|
100
|
-
|
|
101
|
-
includeTargetLocation = stringifyBitranLocation(
|
|
102
|
-
parsePartialBitranLocation(
|
|
103
|
-
tryReplaceAlias(includeNode.parseData.location, aliases),
|
|
104
|
-
parsedLocation,
|
|
105
|
-
),
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
includeTargetLocation = toAbsoluteContentLocation(
|
|
109
|
-
includeTargetLocation,
|
|
110
|
-
parsedLocation.path!,
|
|
111
|
-
);
|
|
112
|
-
} catch (error) {
|
|
113
|
-
travelMap[location] = includeNode.parseData.location;
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (includeTargetLocation in travelMap)
|
|
118
|
-
throw `Include "${printIncludeTarget(includeNode.parseData.location)}" targets "${includeTargetLocation}" which creates infinite loop!`;
|
|
119
|
-
|
|
120
|
-
travelMap[location] = includeNode.parseData.location;
|
|
121
|
-
|
|
122
|
-
//
|
|
123
|
-
// Loading Unique this Include is referencing to.
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
const dbUnique = await ERUDIT_SERVER.DB.manager.findOne(DbUnique, {
|
|
127
|
-
where: { location: includeTargetLocation },
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
if (!dbUnique)
|
|
131
|
-
throw `Include "${printIncludeTarget(includeNode.parseData.location)}" is targeting to non-existing unique "${includeTargetLocation}"!`;
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
// Creating Bitran core within loaded unique's location context.
|
|
135
|
-
//
|
|
136
|
-
|
|
137
|
-
const context: BitranContext = {
|
|
138
|
-
location: parseBitranLocation(includeTargetLocation),
|
|
139
|
-
aliases: dbUnique.context.aliases,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const bitranTranspiler = await createBitranTranspiler();
|
|
143
|
-
|
|
144
|
-
listeners.enter &&
|
|
145
|
-
(await listeners.enter({
|
|
146
|
-
_biCode: dbUnique.content,
|
|
147
|
-
_location: includeTargetLocation,
|
|
148
|
-
_bitranTranspiler: bitranTranspiler,
|
|
149
|
-
}));
|
|
150
|
-
|
|
151
|
-
//
|
|
152
|
-
// Parsing unique content and sub-traversing all includes if any.
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
let stepErrorMessage: string | undefined;
|
|
156
|
-
|
|
157
|
-
await bitranTranspiler.parser.parse(dbUnique.content, {
|
|
158
|
-
step: async (node) => {
|
|
159
|
-
if (stepErrorMessage) return;
|
|
160
|
-
|
|
161
|
-
// Skip Alias nodes to prevent them being injected into calling document context and possibly conflicting with other aliases, includes and links...
|
|
162
|
-
if (node instanceof AliasesNode) return;
|
|
163
|
-
|
|
164
|
-
// Replacing block ids with absolute ones to make possible to link to them
|
|
165
|
-
if (node instanceof BlockNode)
|
|
166
|
-
node.meta.id = Object.keys(travelMap)
|
|
167
|
-
.concat([location])
|
|
168
|
-
.join('__');
|
|
169
|
-
|
|
170
|
-
if (node instanceof LinkNode) {
|
|
171
|
-
const linkTarget = createLinkTarget(node.parseData.target, {
|
|
172
|
-
location: context.location,
|
|
173
|
-
aliases: context.aliases ?? {},
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
switch (linkTarget.type) {
|
|
177
|
-
case 'unique':
|
|
178
|
-
node.parseData.target = toAbsoluteContentLocation(
|
|
179
|
-
linkTarget.strlocation,
|
|
180
|
-
context.location?.path!,
|
|
181
|
-
);
|
|
182
|
-
break;
|
|
183
|
-
case 'page':
|
|
184
|
-
node.parseData.target = `page|${linkTarget.pageType as any}|${toAbsoluteContentId(linkTarget.path!, context.location?.path!)}`;
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (!(node instanceof IncludeNode)) {
|
|
190
|
-
listeners.step &&
|
|
191
|
-
(await listeners.step({
|
|
192
|
-
_location: includeTargetLocation,
|
|
193
|
-
_node: node,
|
|
194
|
-
_bitranTranspiler: bitranTranspiler,
|
|
195
|
-
}));
|
|
196
|
-
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
await _traverseStep(
|
|
202
|
-
node,
|
|
203
|
-
includeTargetLocation,
|
|
204
|
-
context.aliases,
|
|
205
|
-
listeners,
|
|
206
|
-
travelMap,
|
|
207
|
-
);
|
|
208
|
-
} catch (message: any) {
|
|
209
|
-
stepErrorMessage = message;
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
if (stepErrorMessage) throw stepErrorMessage;
|
|
215
|
-
|
|
216
|
-
//
|
|
217
|
-
// Leaving from current Include
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
listeners.leave &&
|
|
221
|
-
(await listeners.leave({
|
|
222
|
-
_location: includeTargetLocation,
|
|
223
|
-
}));
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function printIncludeTarget(target: string) {
|
|
227
|
-
return `<~ ${target}`;
|
|
228
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isTopicPart,
|
|
3
|
-
parseBitranLocation,
|
|
4
|
-
stringifyBitranLocation,
|
|
5
|
-
type BitranContext,
|
|
6
|
-
} from '@erudit-js/cog/schema';
|
|
7
|
-
import type { LinkParseData } from '@erudit-js/bitran-elements/link/shared';
|
|
8
|
-
import {
|
|
9
|
-
createLinkTarget,
|
|
10
|
-
type LinkTarget,
|
|
11
|
-
} from '@erudit-js/bitran-elements/link/target';
|
|
12
|
-
|
|
13
|
-
import { DbUnique } from '@server/db/entities/Unique';
|
|
14
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
15
|
-
import { DbContent } from '@server/db/entities/Content';
|
|
16
|
-
import { DbContributor } from '@server/db/entities/Contributor';
|
|
17
|
-
import {
|
|
18
|
-
toAbsoluteContentId,
|
|
19
|
-
toAbsoluteContentLocation,
|
|
20
|
-
} from '@server/content/absoluteId';
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
createBitranLocationLink,
|
|
24
|
-
createContentLink,
|
|
25
|
-
createContributorLink,
|
|
26
|
-
createTopicPartLink,
|
|
27
|
-
} from '@erudit/shared/link';
|
|
28
|
-
|
|
29
|
-
export async function resolveLinkTarget(
|
|
30
|
-
linkData: LinkParseData,
|
|
31
|
-
context: BitranContext,
|
|
32
|
-
): Promise<LinkTarget> {
|
|
33
|
-
const linkTarget = createLinkTarget(linkData.target, context);
|
|
34
|
-
|
|
35
|
-
if (linkTarget.type === 'unique') {
|
|
36
|
-
const absoluteLocation = toAbsoluteContentLocation(
|
|
37
|
-
linkTarget.strlocation,
|
|
38
|
-
context.location?.path!,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const dbUnique = await ERUDIT_SERVER.DB.manager.findOne(DbUnique, {
|
|
42
|
-
select: ['location', 'productName'],
|
|
43
|
-
where: { location: absoluteLocation },
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (!dbUnique)
|
|
47
|
-
throw new Error(
|
|
48
|
-
`Unique "${linkTarget.strlocation}" does not exist!`,
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const targetLocation = parseBitranLocation(dbUnique.location);
|
|
52
|
-
|
|
53
|
-
linkTarget._productName = dbUnique.productName;
|
|
54
|
-
linkTarget._href = createBitranLocationLink(targetLocation);
|
|
55
|
-
linkTarget._absoluteStrLocation =
|
|
56
|
-
stringifyBitranLocation(targetLocation);
|
|
57
|
-
} else if (linkTarget.type === 'page') {
|
|
58
|
-
const absoluteContentId = toAbsoluteContentId(
|
|
59
|
-
linkTarget.path!,
|
|
60
|
-
context.location?.path,
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
switch (linkTarget.pageType) {
|
|
64
|
-
case 'article':
|
|
65
|
-
case 'summary':
|
|
66
|
-
case 'practice':
|
|
67
|
-
case 'group':
|
|
68
|
-
case 'book':
|
|
69
|
-
{
|
|
70
|
-
const dbContent = await ERUDIT_SERVER.DB.manager.findOne(
|
|
71
|
-
DbContent,
|
|
72
|
-
{
|
|
73
|
-
where: { contentId: absoluteContentId },
|
|
74
|
-
},
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
if (!dbContent)
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Page "${linkTarget.pageType}|${absoluteContentId}" does not exist!`,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
linkTarget._href = isTopicPart(linkTarget.pageType)
|
|
83
|
-
? createTopicPartLink(
|
|
84
|
-
linkTarget.pageType,
|
|
85
|
-
absoluteContentId,
|
|
86
|
-
)
|
|
87
|
-
: createContentLink(
|
|
88
|
-
linkTarget.pageType,
|
|
89
|
-
absoluteContentId,
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
case 'contributor':
|
|
95
|
-
{
|
|
96
|
-
const dbContributor =
|
|
97
|
-
await ERUDIT_SERVER.DB.manager.findOne(DbContributor, {
|
|
98
|
-
select: ['contributorId'],
|
|
99
|
-
where: { contributorId: absoluteContentId },
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
if (!dbContributor)
|
|
103
|
-
throw new Error(
|
|
104
|
-
`Contributor "${absoluteContentId}" does not exist!`,
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
linkTarget._href = createContributorLink(
|
|
108
|
-
dbContributor.contributorId,
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return linkTarget;
|
|
116
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PROJECT_DIR } from '#erudit/globalPaths';
|
|
2
|
-
import { IMPORT } from '@server/importer';
|
|
3
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
4
|
-
|
|
5
|
-
export async function setupBitranConfig() {
|
|
6
|
-
try {
|
|
7
|
-
ERUDIT_SERVER.BITRAN_CONFIG = (
|
|
8
|
-
await IMPORT(PROJECT_DIR + '/bitran.config')
|
|
9
|
-
).default;
|
|
10
|
-
} catch {}
|
|
11
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type ElementNode } from '@bitran-js/core';
|
|
2
|
-
import type { BitranLocation } from '@erudit-js/cog/schema';
|
|
3
|
-
import {
|
|
4
|
-
headingName,
|
|
5
|
-
HeadingNode,
|
|
6
|
-
} from '@erudit-js/bitran-elements/heading/shared';
|
|
7
|
-
|
|
8
|
-
import type { Toc } from '@erudit/shared/bitran/toc';
|
|
9
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
10
|
-
import { getBitranContent } from './content';
|
|
11
|
-
import { createBitranTranspiler } from './transpiler';
|
|
12
|
-
|
|
13
|
-
export async function getBitranToc(location: BitranLocation) {
|
|
14
|
-
const content = await getBitranContent(location, false);
|
|
15
|
-
const bitranCore = await createBitranTranspiler();
|
|
16
|
-
|
|
17
|
-
const toc: Toc = [];
|
|
18
|
-
|
|
19
|
-
await bitranCore.parser.parse(content.biCode, {
|
|
20
|
-
async step(node) {
|
|
21
|
-
tryAddToToc(node as ElementNode);
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return toc;
|
|
26
|
-
|
|
27
|
-
function tryAddToToc(node: ElementNode) {
|
|
28
|
-
const tocItemBase = {
|
|
29
|
-
id: node.id,
|
|
30
|
-
productName: node.name,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Check if node is manually excluded from TOC
|
|
34
|
-
if (typeof node.meta?.toc === 'boolean' && !node.meta?.toc) return;
|
|
35
|
-
|
|
36
|
-
if (node instanceof HeadingNode) {
|
|
37
|
-
toc.push({
|
|
38
|
-
...tocItemBase,
|
|
39
|
-
level: node.parseData.level - 1,
|
|
40
|
-
title: node.parseData.title,
|
|
41
|
-
});
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const notHeadingLevel = () => {
|
|
46
|
-
// If TOC is empty, we're at the root level
|
|
47
|
-
if (toc.length === 0) return 0;
|
|
48
|
-
|
|
49
|
-
// Find the most recent heading to determine parent level
|
|
50
|
-
for (let i = toc.length - 1; i >= 0; i--) {
|
|
51
|
-
if (toc[i].productName === headingName) {
|
|
52
|
-
// Found a heading, return its level + 1
|
|
53
|
-
return toc[i].level + 1;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// No heading found in TOC, place at root level
|
|
58
|
-
return 0;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
ERUDIT_SERVER.BITRAN_CONFIG?.toc?.includes(node.name) ||
|
|
63
|
-
node.meta?.toc
|
|
64
|
-
) {
|
|
65
|
-
// Erudit Bitran config says to add these products to TOC
|
|
66
|
-
// Or show in TOC any product with truthy `toc` meta property
|
|
67
|
-
toc.push({
|
|
68
|
-
...tocItemBase,
|
|
69
|
-
level: notHeadingLevel(),
|
|
70
|
-
title: node.meta?.title || node.parseData?.title,
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineBitranTranspiler,
|
|
3
|
-
type ElementTranspilers,
|
|
4
|
-
} from '@bitran-js/transpiler';
|
|
5
|
-
import { eruditDefaultTranspilers } from '@erudit-js/bitran-elements/defaultTranspilers';
|
|
6
|
-
|
|
7
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
8
|
-
|
|
9
|
-
export async function createBitranTranspiler() {
|
|
10
|
-
const projectTranspilers = await getProjectTranspilers();
|
|
11
|
-
|
|
12
|
-
const bitranTranspiler = defineBitranTranspiler({
|
|
13
|
-
...projectTranspilers,
|
|
14
|
-
...eruditDefaultTranspilers,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return bitranTranspiler;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async function getProjectTranspilers(): Promise<ElementTranspilers> {
|
|
21
|
-
const bitranElements = ERUDIT_SERVER?.BITRAN_CONFIG?.elements;
|
|
22
|
-
|
|
23
|
-
if (!bitranElements) return {};
|
|
24
|
-
|
|
25
|
-
const projectTranspilers: ElementTranspilers = {};
|
|
26
|
-
for (const [name, bitranElement] of Object.entries(bitranElements))
|
|
27
|
-
projectTranspilers[name] = await bitranElement.transpiler();
|
|
28
|
-
|
|
29
|
-
return projectTranspilers;
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { debug, logger } from '@server/logger';
|
|
2
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
3
|
-
|
|
4
|
-
export async function close() {
|
|
5
|
-
debug.start('Shutting down server...');
|
|
6
|
-
|
|
7
|
-
await ERUDIT_SERVER.DB?.destroy();
|
|
8
|
-
|
|
9
|
-
logger.success('Server shut down gracefully!');
|
|
10
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
|
-
import { globSync } from 'glob';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import sizeOf from 'image-size';
|
|
5
|
-
import {
|
|
6
|
-
contentTypes,
|
|
7
|
-
type ContentConfig,
|
|
8
|
-
type ContentReferences,
|
|
9
|
-
type ContentType,
|
|
10
|
-
} from '@erudit-js/cog/schema';
|
|
11
|
-
import { resolvePaths } from '@erudit-js/cog/kit';
|
|
12
|
-
|
|
13
|
-
import { PROJECT_DIR } from '#erudit/globalPaths';
|
|
14
|
-
import { stress } from '@erudit/utils/stress';
|
|
15
|
-
|
|
16
|
-
import { debug, logger } from '@server/logger';
|
|
17
|
-
import { ERUDIT_SERVER } from '@server/global';
|
|
18
|
-
import { walkNav } from '@server/nav/utils';
|
|
19
|
-
import { isRootNode, type NavNode } from '@server/nav/node';
|
|
20
|
-
import { DbContent } from '@server/db/entities/Content';
|
|
21
|
-
import { IMPORT } from '@server/importer';
|
|
22
|
-
import { contributorExists } from '@server/repository/contributor';
|
|
23
|
-
import { DbContribution } from '@server/db/entities/Contribution';
|
|
24
|
-
|
|
25
|
-
import { contentAsset } from '@erudit/shared/asset';
|
|
26
|
-
import type { ImageData } from '@erudit/shared/image';
|
|
27
|
-
|
|
28
|
-
import type { BuilderFunctionArgs } from './builderArgs';
|
|
29
|
-
import { contentItemPath } from './path';
|
|
30
|
-
import { buildBook } from './type/book';
|
|
31
|
-
import { buildGroup } from './type/group';
|
|
32
|
-
import { buildTopic } from './type/topic';
|
|
33
|
-
|
|
34
|
-
const typeBuilders: Record<ContentType, Function> = {
|
|
35
|
-
book: buildBook,
|
|
36
|
-
group: buildGroup,
|
|
37
|
-
topic: buildTopic,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export async function buildContent() {
|
|
41
|
-
if (!ERUDIT_SERVER.NAV) return;
|
|
42
|
-
|
|
43
|
-
debug.start('Building content...');
|
|
44
|
-
|
|
45
|
-
const counters: Record<ContentType, number> = Object.fromEntries(
|
|
46
|
-
contentTypes.map((contentType) => [contentType, 0]),
|
|
47
|
-
) as any;
|
|
48
|
-
|
|
49
|
-
await walkNav(async (node) => {
|
|
50
|
-
if (isRootNode(node)) return;
|
|
51
|
-
counters[node.type]++;
|
|
52
|
-
await addContentItem(node);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
logger.success(
|
|
56
|
-
'Content built successfully!',
|
|
57
|
-
chalk.dim(
|
|
58
|
-
'(' +
|
|
59
|
-
Object.entries(counters)
|
|
60
|
-
.map(([k, v]) => `${k.at(0)!.toUpperCase()}: ${v}`)
|
|
61
|
-
.join(', ') +
|
|
62
|
-
')',
|
|
63
|
-
),
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function addContentItem(navNode: NavNode) {
|
|
68
|
-
debug.start(
|
|
69
|
-
`Adding ${stress(navNode.type)} content item ${stress(navNode.id)}...`,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const dbContent = new DbContent();
|
|
73
|
-
dbContent.contentId = navNode.id;
|
|
74
|
-
dbContent.fullId = navNode.fullId;
|
|
75
|
-
dbContent.type = navNode.type;
|
|
76
|
-
dbContent.decoration = getDecoration(navNode);
|
|
77
|
-
dbContent.ogImage = getOgImageData(navNode);
|
|
78
|
-
dbContent.references = await getContentReferences(navNode);
|
|
79
|
-
|
|
80
|
-
let config: Partial<ContentConfig> | undefined;
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
config = (await IMPORT(contentItemPath(navNode, navNode.type), {
|
|
84
|
-
default: true,
|
|
85
|
-
})) as Partial<ContentConfig>;
|
|
86
|
-
|
|
87
|
-
dbContent.title = config.title;
|
|
88
|
-
dbContent.navTitle = config.navTitle;
|
|
89
|
-
dbContent.description = config.description;
|
|
90
|
-
dbContent.flags = config.flags;
|
|
91
|
-
dbContent.dependencies = config.dependencies;
|
|
92
|
-
|
|
93
|
-
if (config.seo) {
|
|
94
|
-
dbContent.seo = {
|
|
95
|
-
title: config.seo?.title,
|
|
96
|
-
description: config.seo?.description,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
await addContributions(navNode, config.contributors);
|
|
101
|
-
} catch {}
|
|
102
|
-
|
|
103
|
-
await ERUDIT_SERVER.DB.manager.save(dbContent);
|
|
104
|
-
|
|
105
|
-
await typeBuilders[navNode.type](<BuilderFunctionArgs>{
|
|
106
|
-
navNode,
|
|
107
|
-
dbContent,
|
|
108
|
-
config,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function getDecoration(navNode: NavNode) {
|
|
113
|
-
if (existsSync(contentItemPath(navNode, 'decoration.svg')))
|
|
114
|
-
return `/${navNode.path}/decoration.svg`;
|
|
115
|
-
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async function addContributions(navNode: NavNode, contributors?: string[]) {
|
|
120
|
-
if (!contributors || !contributors.length) {
|
|
121
|
-
if (navNode.type !== 'book' && navNode.type !== 'group')
|
|
122
|
-
logger.warn(
|
|
123
|
-
`${navNode.type.at(0)!.toUpperCase() + navNode.type.slice(1)} ${stress(navNode.id)} has no contributors!`,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
for (const contributorId of contributors) {
|
|
130
|
-
if (!(await contributorExists(contributorId))) {
|
|
131
|
-
logger.warn(
|
|
132
|
-
`Skipping unknown contributor ${stress(contributorId)} when adding ${navNode.type} ${stress(navNode.id)}!`,
|
|
133
|
-
);
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const dbContribution = new DbContribution();
|
|
138
|
-
dbContribution.contentId = navNode.id;
|
|
139
|
-
dbContribution.contributorId = contributorId;
|
|
140
|
-
await ERUDIT_SERVER.DB.manager.save(dbContribution);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function getOgImageData(navNode: NavNode): ImageData | undefined {
|
|
145
|
-
const ogImagePath = globSync(
|
|
146
|
-
contentItemPath(navNode, 'og-image.{svg,webp,jpg,png}'),
|
|
147
|
-
).pop();
|
|
148
|
-
|
|
149
|
-
if (ogImagePath) {
|
|
150
|
-
const size = sizeOf(ogImagePath);
|
|
151
|
-
return {
|
|
152
|
-
src: contentAsset(
|
|
153
|
-
resolvePaths(ogImagePath).replace(
|
|
154
|
-
PROJECT_DIR + '/content/',
|
|
155
|
-
'',
|
|
156
|
-
),
|
|
157
|
-
),
|
|
158
|
-
width: size.width!,
|
|
159
|
-
height: size.height!,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async function getContentReferences(navNode: NavNode) {
|
|
167
|
-
try {
|
|
168
|
-
const references = await IMPORT(
|
|
169
|
-
contentItemPath(navNode, `references`),
|
|
170
|
-
{ default: true },
|
|
171
|
-
);
|
|
172
|
-
return references as ContentReferences;
|
|
173
|
-
} catch (error) {}
|
|
174
|
-
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|