feat: パッチ7.1最新改修対応「魔獣領域 ハラタリ修練所」完全攻略ページの作成と一覧リンク更新
This commit is contained in:
1 parent
67677f81b2
commit
419ee43660
3 files changed
+330
-1
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
def normalize_file(path):
|
||||
with open(path, 'rb') as f:
|
||||
raw = f.read()
|
||||
text = raw.decode('utf-8', errors='ignore')
|
||||
while text.startswith('\ufeff'):
|
||||
text = text[1:]
|
||||
text = text.replace('\r\n', '\n').replace('\r', '\n')
|
||||
lines = [l.rstrip() for l in text.split('\n')]
|
||||
# 連続空行の削除
|
||||
clean_lines = []
|
||||
prev_blank = False
|
||||
for l in lines:
|
||||
if l == '':
|
||||
if not prev_blank:
|
||||
clean_lines.append(l)
|
||||
prev_blank = True
|
||||
else:
|
||||
clean_lines.append(l)
|
||||
prev_blank = False
|
||||
while clean_lines and clean_lines[-1] == '':
|
||||
clean_lines.pop()
|
||||
final_text = '\r\n'.join(clean_lines) + '\r\n'
|
||||
with open(path, 'wb') as f:
|
||||
f.write(b'\xef\xbb\xbf' + final_text.encode('utf-8'))
|
||||
print(f"Normalized {path}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
normalize_file('dungeons/halatali.html')
|
||||
normalize_file('dungeons/index.html')
|
||||
Reference in new issue
Block a user