Files
ALL-teach_sys/frontend_视觉设计/clean_resume_formatting.py
KQL cd2e307402 初始化12个产业教务系统项目
主要内容:
- 包含12个产业的完整教务系统前端代码
- 智能启动脚本 (start-industry.sh)
- 可视化产业导航页面 (index.html)
- 项目文档 (README.md)

优化内容:
- 删除所有node_modules和.yoyo文件夹,从7.5GB减少到2.7GB
- 添加.gitignore文件避免上传不必要的文件
- 自动依赖管理和智能启动系统

产业列表:
1. 文旅产业 (5150)
2. 智能制造 (5151)
3. 智能开发 (5152)
4. 财经商贸 (5153)
5. 视觉设计 (5154)
6. 交通物流 (5155)
7. 大健康 (5156)
8. 土木水利 (5157)
9. 食品产业 (5158)
10. 化工产业 (5159)
11. 能源产业 (5160)
12. 环保产业 (5161)

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:14:14 +08:00

100 lines
3.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
清理修改版简历中的删除线内容和加粗符号
- 删除~~删除线内容~~(包括符号和内容)
- 保留**加粗内容**(删除符号,保留内容)
"""
import re
import shutil
from datetime import datetime
def clean_resume_formatting():
"""清理修改版简历格式"""
file_path = "src/mocks/resumeInterviewMock.js"
# 创建备份
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
backup_path = f"{file_path}.backup_clean_formatting_{timestamp}"
shutil.copy2(file_path, backup_path)
print(f"📦 已创建备份: {backup_path}")
try:
# 读取文件
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
print("🚀 开始清理修改版简历格式...")
# 统计原始符号数量
strikethrough_count = content.count('~~')
bold_count = content.count('**')
print(f"📊 发现删除线符号: {strikethrough_count//2}")
print(f"📊 发现加粗符号: {bold_count//2}")
# 定义清理函数
def clean_content_field(match):
"""清理content字段中的modified内容"""
full_match = match.group(0)
modified_content = match.group(1)
# 1. 删除删除线内容(包括~~符号和其中的内容~~
cleaned = re.sub(r'~~[^~]*~~', '', modified_content)
# 2. 删除加粗符号(保留**中的内容**
cleaned = re.sub(r'\*\*([^*]*)\*\*', r'\1', cleaned)
# 3. 清理多余的空格和标点符号
# 处理可能产生的多余逗号、分号等
cleaned = re.sub(r'[,、;]\s*[,、;]', '', cleaned)
cleaned = re.sub(r'[,、;]\s*$', '', cleaned, flags=re.MULTILINE)
cleaned = re.sub(r'^\s*[,、;]', '', cleaned, flags=re.MULTILINE)
# 4. 清理多余的空白行
cleaned = re.sub(r'\n\s*\n\s*\n', '\n\n', cleaned)
return f'"modified": "{cleaned}"'
# 使用正则表达式找到所有modified字段并清理
modified_pattern = r'"modified":\s*"([^"]*(?:\\.[^"]*)*)"'
processed_content = re.sub(modified_pattern, clean_content_field, content, flags=re.DOTALL)
# 统计处理后的符号数量
final_strikethrough = processed_content.count('~~')
final_bold = processed_content.count('**')
# 写入文件
with open(file_path, 'w', encoding='utf-8') as f:
f.write(processed_content)
print(f"📊 处理统计:")
print(f" - 删除线符号: {strikethrough_count//2}{final_strikethrough//2}")
print(f" - 加粗符号: {bold_count//2}{final_bold//2}")
print(f"✅ 已更新 {file_path}")
# 验证JS语法
import subprocess
try:
result = subprocess.run(['node', '-c', file_path], capture_output=True, text=True)
if result.returncode == 0:
print("✅ JavaScript语法验证通过")
else:
print(f"❌ JavaScript语法验证失败: {result.stderr}")
# 恢复备份
shutil.copy2(backup_path, file_path)
print("🔄 已恢复原始文件")
except Exception as e:
print(f"⚠️ 无法验证JavaScript语法: {e}")
except Exception as e:
print(f"❌ 处理失败: {e}")
# 恢复备份
shutil.copy2(backup_path, file_path)
print("🔄 已恢复原始文件")
if __name__ == "__main__":
print("🚀 开始清理修改版简历格式...")
clean_resume_formatting()
print("🎉 处理完成!")