Files
ff14-guide/tools/update_lapis_manalis.py
T

44 lines
1.8 KiB
Python

import sys
def main():
with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f:
content = f.read()
target = """ <tr>
<td><strong>雪山冥洞 ラピス・マナリス</strong></td>
<td>Lv90 (IL605〜)</td>
<td><strong>対応</strong></td>
<td>パッチ6.3メインID。ガレマルド山岳部・リーパー発祥の地。カイナッツォ前哨戦。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>雪山冥洞 ラピス・マナリス</strong></td>
<td>Lv90 (IL605〜)</td>
<td><strong>対応</strong></td>
<td>パッチ6.3メインID。ガレマルド山岳部・リーパー発祥の地。カイナッツォ前哨戦。</td>
<td><a href="lapis_manalis.html">攻略を見る ➜</a></td>
</tr>"""
if target not in content:
print("エラー: ターゲット文字列が見つかりません")
sys.exit(1)
content = content.replace(target, replacement)
lines = [line.rstrip() for line in content.splitlines()]
content_clean = '\r\n'.join(lines) + '\r\n'
with open('dungeons/index.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + content_clean.encode('utf-8'))
with open('dungeons/lapis_manalis.html', 'r', encoding='utf-8-sig') as f:
lap = f.read()
lap_lines = [line.rstrip() for line in lap.splitlines()]
lap_clean = '\r\n'.join(lap_lines) + '\r\n'
with open('dungeons/lapis_manalis.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + lap_clean.encode('utf-8'))
print("雪山冥洞 ラピス・マナリスのリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()