diff --git a/.gitignore b/.gitignore index 82799e1..c6b18d7 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ pnpm-debug.log* # ignore test articles except for article definitions src/content/* !src/content/config.ts + +# ignore generated html from makeinfo +src/pages/article/translation/*.html + diff --git a/.prettierrc.mjs b/.prettierrc.mjs new file mode 100644 index 0000000..aa2deee --- /dev/null +++ b/.prettierrc.mjs @@ -0,0 +1,12 @@ +/** @type {import("prettier").Config} */ +export default { + plugins: ['prettier-plugin-astro'], + overrides: [ + { + files: '*.astro', + options: { + parser: 'astro', + }, + }, + ], +}; \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a6d1c00 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "[json]": { + "editor.tabSize": 2 + }, + "[javascript]": { + "editor.tabSize": 2 + }, + "[typescript]": { + "editor.tabSize": 2 + } +} diff --git a/README.md b/README.md index ff1fabe..69d495e 100644 --- a/README.md +++ b/README.md @@ -1 +1,12 @@ +# 李守中的个人站 + 个人资料、文章与工具站点。由 Astro 框架构建,使用 typescript 编写。 + +## 关于翻译类文章的发布方式 + +翻译类文章不由 Astro 生成,而是预先使用 texinfo 编写后编译到 HTML 文件,将其放于固定位置,再在 Astro 页面中引用这些文件。 + +这意味着每有一个新的翻译类文章要发布时,需要: + +1. 更新 pages/article/translation/index.astro 文件中翻译类文章的列表; +2. 更新 astro.config.mjs 文件中的 sitemap 插件配置,填入 texinfo 编译出的 HTML 文件的 URL 以使这些文章可以进入 sitemap.xml 中,从而可以被搜索引擎收录。 diff --git a/astro.config.mjs b/astro.config.mjs index 0478374..d78845f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -35,8 +35,25 @@ export default defineConfig({ site: 'https://lishouzhong.com', integrations: [ sitemap({ + customPages: [ + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFS exports man(5) page 2021 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFS mountd man(8) page 2020 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFS nfsd man(8) page 2019 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFS showmount man(8) page 2016 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFSv4 man(4) page 2019 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFSv4 nfscbd man(8) page 2009 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFSv4 nfsrevoke man(8) page 2009 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 NFSv4 nfsuserd man(8) page 2019 中文译本.html", + "https://lishouzhong.com/file_share/translation/FreeBSD 13 rpcbind man(8) page 2017 中文译本.html", + "https://lishouzhong.com/file_share/translation/EasyRSA Intro-To-PKI v3.08 中文译本.html", + "https://lishouzhong.com/file_share/translation/EasyRSA-Advanced v3.08 中文译本.html", + "https://lishouzhong.com/file_share/translation/EasyRSA-Readme v3.08 中文译本.html", + "https://lishouzhong.com/file_share/translation/EasyRSA-Upgrade-Notes v3.08 中文译本.html", + "https://lishouzhong.com/file_share/translation/iperf3 v3.9 man page 中文译本.html", + "https://lishouzhong.com/file_share/translation/PostgreSQL Don't Do This 中文译本.html", + "https://lishouzhong.com/file_share/translation/rsync v3.2.7 man(1) page 中文译本.html", + ], // entryLimit: 10000, - // customPages: [], // filter: (page) => { }, // lastmod: new Date('2022-02-24'), // serialize(item) { diff --git a/package-lock.json b/package-lock.json index c65cb9b..1c894e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,8 @@ "astro": "^4.9.2", "bignumber.js": "^9.1.2", "pinyin-pro": "^3.22.0", + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1", "remark-toc": "^9.0.0", "typescript": "^5.4.5", "vue": "^3.4.29" @@ -58,9 +60,10 @@ } }, "node_modules/@astrojs/compiler": { - "version": "2.8.0", - "resolved": "https://registry.npmmirror.com/@astrojs/compiler/-/compiler-2.8.0.tgz", - "integrity": "sha512-yrpD1WRGqsJwANaDIdtHo+YVjvIOFAjC83lu5qENIgrafwZcJgSXDuwVMXOgok4tFzpeKLsFQ6c3FoUdloLWBQ==" + "version": "2.10.3", + "resolved": "https://registry.npmmirror.com/@astrojs/compiler/-/compiler-2.10.3.tgz", + "integrity": "sha512-bL/O7YBxsFt55YHU021oL+xz+B/9HvGNId3F9xURN16aeqDK9juHGktdkCSXz+U4nqFACq6ZFvWomOzhV+zfPw==", + "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { "version": "0.4.0", @@ -5400,6 +5403,35 @@ "node": ">=8.15" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-astro": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz", + "integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==", + "license": "MIT", + "dependencies": { + "@astrojs/compiler": "^2.9.1", + "prettier": "^3.0.0", + "sass-formatter": "^0.7.6" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } + }, "node_modules/prismjs": { "version": "1.29.0", "resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.29.0.tgz", @@ -6114,6 +6146,21 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/s.color": { + "version": "0.0.15", + "resolved": "https://registry.npmmirror.com/s.color/-/s.color-0.0.15.tgz", + "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", + "license": "MIT" + }, + "node_modules/sass-formatter": { + "version": "0.7.9", + "resolved": "https://registry.npmmirror.com/sass-formatter/-/sass-formatter-0.7.9.tgz", + "integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==", + "license": "MIT", + "dependencies": { + "suf-log": "^2.5.3" + } + }, "node_modules/sax": { "version": "1.4.1", "resolved": "https://registry.npmmirror.com/sax/-/sax-1.4.1.tgz", @@ -6395,6 +6442,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/suf-log": { + "version": "2.5.3", + "resolved": "https://registry.npmmirror.com/suf-log/-/suf-log-2.5.3.tgz", + "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", + "license": "MIT", + "dependencies": { + "s.color": "0.0.15" + } + }, "node_modules/superjson": { "version": "2.2.1", "resolved": "https://registry.npmmirror.com/superjson/-/superjson-2.2.1.tgz", diff --git a/package.json b/package.json index 69f7e5e..063bc7a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "astro": "^4.9.2", "bignumber.js": "^9.1.2", "pinyin-pro": "^3.22.0", + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1", "remark-toc": "^9.0.0", "typescript": "^5.4.5", "vue": "^3.4.29" diff --git a/script/build_on_linux.sh b/script/build_on_linux.sh index 736c00e..c4846f7 100644 --- a/script/build_on_linux.sh +++ b/script/build_on_linux.sh @@ -8,11 +8,21 @@ script_path="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" original_article_home="/home/ld/Documents/ld_article" original_article_destination="/opt/ld-site/src/content" ld_site_dist_target="/opt/nginx_targets/ld_site_dist" +translation_article_path="/opt/nginx_targets/file_share/translation" rsync -a --delete-after -f"P config.ts" \ "${original_article_home}/" \ "${original_article_destination}/" +cd "${original_article_destination}/translation" +makeinfo --html --no-split --css-include=theme.css ./*.texi +if [ $? -ne 0 ]; then + echo "cannot generate translation article, check 'makeinfo' command output." + exit 1 +fi +rm -rf "${translation_article_path}/*.html" +mv ./*.html "${translation_article_path}/" + cd "${script_path}/../" npm run build @@ -21,6 +31,6 @@ if [ $? -ne 0 ]; then exit 1 fi -mv ${ld_site_dist_target} "${ld_site_dist_target}-old" +mv ${ld_site_dist_target} "${ld_site_dist_target}_old" mv dist ${ld_site_dist_target} -rm -rf "${ld_site_dist_target}-old" +rm -rf "${ld_site_dist_target}_old" diff --git a/src/components/HTMLCommonHead.astro b/src/components/HTMLCommonHead.astro index b98a5a0..414ce53 100644 --- a/src/components/HTMLCommonHead.astro +++ b/src/components/HTMLCommonHead.astro @@ -7,7 +7,7 @@ const { title } = Astro.props; - +
1024 进制并以 Byte 计:
以 Byte (B) / bit (b) 计:
1000 进制并以 bit 计: