Skip to content

Commit a297fab

Browse files
committed
refactor(scripts): optimize update_lang.py
1 parent 1f7bee9 commit a297fab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/update_lang.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ def translate_markdown_file(input_file, output_file, target_language, model="dee
186186

187187
# Extract front matter
188188
front_matter_match = re.match(r'---\n(.*?)\n---', content, re.DOTALL)
189-
front_matter = front_matter_match.group(1) if front_matter_match else ""
189+
if front_matter_match:
190+
front_matter = front_matter_match.group(1)
191+
else:
192+
raise Exception("No front matter found in markdown file")
190193
content_without_front_matter = content[len(front_matter_match.group(0)):] if front_matter_match else content
191194

192195
print(f"front_matter_match: {front_matter_match}")

0 commit comments

Comments
 (0)