| 12345678910111213141516171819202122 |
- # -*- coding: utf-8 -*-
- with open('d:/caidawork/openclaw-voc-skill/claude-code/claude-code-qiwe-assistant/mcp/src/dashboard/app.js', 'r', encoding='utf-8') as f:
- lines = f.readlines()
- # 找到并修复所有被拆分的 split(/\n|\r/)
- i = 0
- while i < len(lines):
- line = lines[i]
- # 匹配 .split(/ 后跟换行,下一行是 |,再下一行是 /)
- if '.split(/' in line and line.rstrip().endswith('split(/'):
- if i + 2 < len(lines) and lines[i+1].strip() == '|' and lines[i+2].strip().startswith('/).map'):
- indent = line[:len(line) - len(line.lstrip())]
- lines[i] = line.replace('split(/', 'split(/\\n|\\r/')
- del lines[i+1:i+3]
- continue
- i += 1
- with open('d:/caidawork/openclaw-voc-skill/claude-code/claude-code-qiwe-assistant/mcp/src/dashboard/app.js', 'w', encoding='utf-8') as f:
- f.writelines(lines)
- print('fixed split regex')
|