Skip to content

Commit b5eec34

Browse files
committed
fix: correct path references in batch_convert_html.sh
The script was using incorrect relative paths after changing to the scripts/ directory. Fixed: - Changed initial cd from SCRIPT_DIR/../ to SCRIPT_DIR/../../ to reach project root - Updated converter script paths from ./converters/ to ../tools/converters/ - Moved directory existence checks before cd to scripts/ Fixes #38
1 parent e5005a5 commit b5eec34

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

tools/converters/batch_convert_html.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ esac
6262
print_info "批量转换 YAML 文件为 HTML ($LANGUAGE_MODE 模式)"
6363
print_info "========================================"
6464

65-
# cd 当前脚本所在目录
65+
# cd 到项目根目录
6666
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
67-
cd "$SCRIPT_DIR/../"
67+
cd "$SCRIPT_DIR/../../"
6868

6969
# echo 当前目录
7070
print_info "当前目录: $PWD"
@@ -77,21 +77,21 @@ if [ ! -d "scripts" ] || [ ! -d "expanded_schemas" ]; then
7777
exit 1
7878
fi
7979

80-
# 切换到 scripts 目录
81-
print_info "切换到 scripts 目录..."
82-
cd scripts
83-
8480
# 检查必要的文件和目录
85-
if [ ! -f "./converters/yaml_to_html.py" ]; then
86-
print_error "转换脚本不存在: ./converters/yaml_to_html.py"
81+
if [ ! -f "./tools/converters/yaml_to_html.py" ]; then
82+
print_error "转换脚本不存在: ./tools/converters/yaml_to_html.py"
8783
exit 1
8884
fi
8985

90-
if [ ! -d "../expanded_schemas" ]; then
91-
print_error "源目录不存在: ../expanded_schemas"
86+
if [ ! -d "./expanded_schemas" ]; then
87+
print_error "源目录不存在: ./expanded_schemas"
9288
exit 1
9389
fi
9490

91+
# 切换到 scripts 目录
92+
print_info "切换到 scripts 目录..."
93+
cd scripts
94+
9595
# 根据语言模式确定输出目录
9696
case "$LANGUAGE_MODE" in
9797
mixed)
@@ -153,7 +153,7 @@ for yaml_file in ../expanded_schemas/*.expanded.yaml; do
153153
print_info "转换: $filename.expanded.yaml -> $filename.html ($LANGUAGE_MODE)"
154154

155155
# 执行转换
156-
if "$PYTHON_BIN" ./converters/yaml_to_html.py "$yaml_file" -o "$html_file" -l "$LANGUAGE_MODE"; then
156+
if "$PYTHON_BIN" ../tools/converters/yaml_to_html.py "$yaml_file" -o "$html_file" -l "$LANGUAGE_MODE"; then
157157
print_success "✓ 转换成功: $filename.html"
158158
((++success_count))
159159
else
@@ -167,7 +167,7 @@ done
167167

168168
# 生成索引文件
169169
print_info "生成索引文件..."
170-
"$PYTHON_BIN" ./converters/generate_index.py -l "$LANGUAGE_MODE" -d "$OUTPUT_DIR"
170+
"$PYTHON_BIN" ../tools/converters/generate_index.py -l "$LANGUAGE_MODE" -d "$OUTPUT_DIR"
171171
print_success "索引文件生成完成"
172172

173173
# 返回项目根目录

0 commit comments

Comments
 (0)