44 lines
1.5 KiB
Bash
Executable File
44 lines
1.5 KiB
Bash
Executable File
#!/bin/zsh
|
|
|
|
# 确保pandoc已安装
|
|
if ! command -v pandoc &> /dev/null; then
|
|
echo "错误: 需要安装pandoc。请运行 'brew install pandoc' 安装。"
|
|
exit 1
|
|
fi
|
|
|
|
# 创建输出目录
|
|
mkdir -p docx_output
|
|
|
|
# 转换文件并设置对应的中文名
|
|
convert_file() {
|
|
md_file=$1
|
|
cn_name=$2
|
|
cn_docx="docx_output/$cn_name"
|
|
|
|
if [ -f "$md_file" ]; then
|
|
echo "正在将 $md_file 转换为 $cn_docx..."
|
|
pandoc "$md_file" -o "$cn_docx" --reference-doc=reference.docx 2>/dev/null ||
|
|
pandoc "$md_file" -o "$cn_docx"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "✅ 成功转换: $cn_docx"
|
|
else
|
|
echo "❌ 转换失败: $md_file"
|
|
fi
|
|
else
|
|
echo "❌ 文件不存在: $md_file"
|
|
fi
|
|
}
|
|
|
|
# 逐个处理文件
|
|
convert_file "water_biz_database_design.md" "福建水务业务系统数据库设计.docx"
|
|
convert_file "water_biz_deployment_design.md" "福建水务业务系统部署设计.docx"
|
|
convert_file "water_biz_design_plan.md" "福建水务业务系统设计方案.docx"
|
|
convert_file "water_biz_integrated_doc.md" "福建水务业务系统集成文档.docx"
|
|
convert_file "water_biz_interface_design.md" "福建水务业务系统接口设计.docx"
|
|
convert_file "water_biz_module_design.md" "福建水务业务系统模块设计.docx"
|
|
convert_file "water_biz_summary.md" "福建水务业务系统概要.docx"
|
|
convert_file "water_biz_system_architecture.md" "福建水务业务系统架构.docx"
|
|
|
|
echo "转换完成! 输出文件保存在 docx_output/ 目录下"
|