diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index fe0f717..62666c2 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -40,10 +40,10 @@ jobs: - name: Setup API markdown run: |- python -m pip install litedoc - python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var - python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var - python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var - python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var + python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var -cs + python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var -cs + python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var -cs + python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var -cs - name: 安装 pnpm uses: pnpm/action-setup@v2 diff --git a/.gitignore b/.gitignore index 927b37e..2a40965 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,8 @@ litedoc/ docs/zh/api/ docs/zht/api/ docs/en/api/ -docs/ja/api/ \ No newline at end of file +docs/ja/api/ + +# litedoc +mkdoc.bat +mkdoc_exp.bat \ No newline at end of file diff --git a/docs/.vitepress/config/common.ts b/docs/.vitepress/config/common.ts index e31531d..29d898d 100644 --- a/docs/.vitepress/config/common.ts +++ b/docs/.vitepress/config/common.ts @@ -14,7 +14,42 @@ const commonSidebarOptions = { useFolderTitleFromIndexFile: true, useFolderLinkFromIndexFile: true, includeFolderIndexFile: true, + rootGroupText: 'MBCP', } + +/** + * Generate sidebar config + * multiple languages and sections + * @returns {any[]} + */ +function generateSidebarConfig(): any[] { + let sections = ["api", "refer", "guide"] + let languages = ['zh', 'en', 'ja', 'zht'] + let ret = [] + for (let language of languages) { + for (let section of sections) { + if (language === defaultLocale) { + ret.push({ + basePath: `/${section}/`, + scanStartPath: `${language}/${section}`, + resolvePath: `/${section}/`, + ...commonSidebarOptions + }) + } else { + ret.push({ + basePath: `/${language}/${section}/`, + scanStartPath: `${language}/${section}`, + resolvePath: `/${language}/${section}/`, + ...commonSidebarOptions + }) + } + } + } + return ret +} + +console.log(generateSidebarConfig()) + export const common = defineConfig({ title: "MBCP docs", description: "MBCP library docs", @@ -27,23 +62,7 @@ export const common = defineConfig({ themeConfig: { sidebar: generateSidebar( [ - ...[defaultLocale, 'en', 'ja', 'zht'].map((locale) => { - if (locale === defaultLocale) { - return { - basePath: '/api/', - scanStartPath: `${locale}/api`, - resolvePath: '/api/', - ...commonSidebarOptions - } - } else { - return { - basePath: `/${locale}/api/`, - scanStartPath: `${locale}/api`, - resolvePath: `/${locale}/api/`, - ...commonSidebarOptions - } - } - }) + ...generateSidebarConfig() ] ), socialLinks: [ diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts index 7068daf..705cc88 100644 --- a/docs/.vitepress/config/en.ts +++ b/docs/.vitepress/config/en.ts @@ -6,6 +6,7 @@ export const en = defineConfig({ themeConfig: { nav: [ {text: 'Get Start', link: '/en/guide/'}, + {text: 'Reference', link: '/en/refer'}, {text: 'API Document', link: '/en/api/'}, {text: 'Demo', link: '/en/demo/'}, ], diff --git a/docs/.vitepress/config/ja.ts b/docs/.vitepress/config/ja.ts index a8ad029..1d802ea 100644 --- a/docs/.vitepress/config/ja.ts +++ b/docs/.vitepress/config/ja.ts @@ -6,6 +6,7 @@ export const ja = defineConfig({ themeConfig: { nav: [ {text: 'スタート', link: '/ja/guide/'}, + {text: 'リファレンス', link: '/ja/refer'}, {text: 'APIドキュメント', link: '/ja/api/'}, {text: 'インスタンス', link: '/ja/demo/'}, ], diff --git a/docs/.vitepress/config/zh.ts b/docs/.vitepress/config/zh.ts index 8953293..9554393 100644 --- a/docs/.vitepress/config/zh.ts +++ b/docs/.vitepress/config/zh.ts @@ -6,6 +6,7 @@ export const zh = defineConfig({ themeConfig: { nav: [ {text: '快速开始', link: '/guide/'}, + {text: '参考', link: '/refer'}, {text: 'API文档', link: '/api/'}, {text: '实例', link: '/demo/'}, ], diff --git a/docs/.vitepress/config/zht.ts b/docs/.vitepress/config/zht.ts index a9d4338..84e879a 100644 --- a/docs/.vitepress/config/zht.ts +++ b/docs/.vitepress/config/zht.ts @@ -7,6 +7,7 @@ export const zht = defineConfig({ themeConfig: { nav: [ {text: '指引', link: '/zht/guide/'}, + {text: '參考', link: '/zht/refer'}, {text: 'API文檔', link: '/zht/api/'}, {text: '示範', link: '/zht/demo/'}, ], diff --git a/docs/en/refer/index.md b/docs/en/refer/index.md new file mode 100644 index 0000000..e186b24 --- /dev/null +++ b/docs/en/refer/index.md @@ -0,0 +1,3 @@ +# Reference +help us to improve the documentation +``` \ No newline at end of file diff --git a/docs/ja/refer/index.md b/docs/ja/refer/index.md new file mode 100644 index 0000000..8d36e75 --- /dev/null +++ b/docs/ja/refer/index.md @@ -0,0 +1,4 @@ +# Reference + +Help us to improve the documentation +``` \ No newline at end of file diff --git a/docs/zh/refer/function/curry.md b/docs/zh/refer/function/curry.md new file mode 100644 index 0000000..28bc879 --- /dev/null +++ b/docs/zh/refer/function/curry.md @@ -0,0 +1,3 @@ +--- +title: 柯里化 +--- \ No newline at end of file diff --git a/docs/zh/refer/function/function.md b/docs/zh/refer/function/function.md new file mode 100644 index 0000000..274d0ee --- /dev/null +++ b/docs/zh/refer/function/function.md @@ -0,0 +1,3 @@ +--- +title: 函数 +--- \ No newline at end of file diff --git a/docs/zh/refer/index.md b/docs/zh/refer/index.md new file mode 100644 index 0000000..664696e --- /dev/null +++ b/docs/zh/refer/index.md @@ -0,0 +1,8 @@ +--- +title: 参考 +--- + +# Reference + +Help us to improve the documentation +``` \ No newline at end of file diff --git a/docs/zht/refer/index.md b/docs/zht/refer/index.md new file mode 100644 index 0000000..8d36e75 --- /dev/null +++ b/docs/zht/refer/index.md @@ -0,0 +1,4 @@ +# Reference + +Help us to improve the documentation +``` \ No newline at end of file diff --git a/mkdoc.bat b/mkdoc.bat index bbf1216..97c7646 100644 --- a/mkdoc.bat +++ b/mkdoc.bat @@ -1,5 +1,5 @@ chcp 65001 -python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var -python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var -python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var -python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var \ No newline at end of file +python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var -cs +python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var -cs +python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var -cs +python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var -cs \ No newline at end of file