修复脚本遗漏
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2025-08-25 19:39:47 +08:00
parent c9c748bafa
commit 3762b65a8b

View File

@@ -86,6 +86,30 @@ function Replace_Url() {
done
}
function Replace_Url() {
SEND_INFO "------------ 开始替换 Gitee 链接为 Blog 链接 ------------"
# 使用更精确的匹配模式处理包含中文和其他特殊字符的URL
grep -r 'https://gitee.com/offends/' --include="*.md" . | while read -r line; do
file=$(echo "$line" | awk -F ':' '{print $1}')
# 一次性完成所有替换操作
sed -i '
# 处理标准格式的Gitee链接
s|https://gitee.com/offends/\([^/]*\)/blob/main/\(.*\)\.md|https://blog.offends.cn/\1/\2.html|g
s|https://gitee.com/offends/\([^/]*\)/blob/main/\(.*\)\.md#\(.*\)|https://blog.offends.cn/\1/\2.html#\3|g
# 额外处理可能遗漏的.md后缀
s|\(https://blog.offends.cn/[^)]*\)\.md|\1.html|g
s|\.md#|.html#|g
s|\.md$|.html|g
s|\.md)|.html)|g
' "$file"
done
SEND_INFO "------------ 替换完成 ------------"
}
function All() {
SEND_INFO "开始构建......"
Clean_File