#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Settings.php 结构优化脚本 - 步骤2 完成以下任务: 1. 在外观样式中添加动画效果子分类 2. 删除杂项中重复的动画效果设置 """ def main(): # 读取文件 with open('settings.php', 'r', encoding='utf-8') as f: content = f.read() print("开始优化 settings.php (步骤2: 动画效果重组)...") print(f"原始文件: {len(content)} 字符, {content.count(chr(10))} 行") # 1. 在外观样式的字体设置后添加动画效果子分类 old_font_section = '''

''' new_font_with_animation = '''

''' if old_font_section in content: content = content.replace(old_font_section, new_font_with_animation) print("✓ 在外观样式中添加了动画效果子分类") else: print("✗ 未找到字体设置部分") # 2. 删除杂项中重复的动画效果设置 old_misc_with_animation = '''

''' new_misc_without_animation = '''

''' if old_misc_with_animation in content: content = content.replace(old_misc_with_animation, new_misc_without_animation) print("✓ 删除了杂项中重复的动画效果设置") else: print("✗ 未找到杂项中的动画效果设置") # 保存文件 with open('settings.php', 'w', encoding='utf-8') as f: f.write(content) print(f"\n优化完成! 新文件: {len(content)} 字符, {content.count(chr(10))} 行") print("请检查 settings.php 文件") if __name__ == '__main__': main()