Files
ff14-guide/tools/sync_wiki_common_js.py

27 lines
1.4 KiB
Python

import sys
sys.stdout.reconfigure(encoding='utf-8')
with open('common/js/wiki_common.js', 'r', encoding='utf-8') as f:
content = f.read()
# 1. globalNav に追加(まだなければ)
if "{ title: '🔨 ギャザクラ完全攻略', path: 'crafter_gatherer/index.html' }" not in content:
target_gnav = "{ title: '🐎 マウント完全攻略', path: 'mounts/index.html' },"
replace_gnav = "{ title: '🐎 マウント完全攻略', path: 'mounts/index.html' },\n { title: '🔨 ギャザクラ完全攻略', path: 'crafter_gatherer/index.html' },"
if target_gnav in content:
content = content.replace(target_gnav, replace_gnav, 1)
print("Updated globalNav")
# 2. sidebar のメインメニューに追加(まだなければ)
if "{ text: '🔨 ギャザクラ総合攻略・育成', path: 'crafter_gatherer/index.html' }" not in content:
target_sb = "{ text: '🐎 マウント総合・全一覧', path: 'mounts/index.html' },"
replace_sb = "{ text: '🐎 マウント総合・全一覧', path: 'mounts/index.html' },\n { text: '🔨 ギャザクラ総合攻略・育成', path: 'crafter_gatherer/index.html' },"
if target_sb in content:
content = content.replace(target_sb, replace_sb, 1)
print("Updated sidebar main menu")
with open('common/js/wiki_common.js', 'w', encoding='utf-8') as f:
f.write(content)
print("Saved common/js/wiki_common.js")