From 32fd428cc0b2c5d8e6d316c70fa84013bd1a5f87 Mon Sep 17 00:00:00 2001 From: uduki Date: Thu, 29 Oct 2026 16:23:33 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20wiki=5Fcommon.js=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=83=84=E3=83=BC=E3=83=AB=E3=81=AE=E3=82=B3=E3=83=9F=E3=83=83?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/update_wiki_common_js.py | 59 ++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tools/update_wiki_common_js.py diff --git a/tools/update_wiki_common_js.py b/tools/update_wiki_common_js.py new file mode 100644 index 0000000..714c2fe --- /dev/null +++ b/tools/update_wiki_common_js.py @@ -0,0 +1,59 @@ +import re +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 "'crafter_gatherer/index.html'" not in content: + # globalNav の置換 + 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") + else: + print("target_gnav not found!") + + # 2. sidebar のメインメニューにギャザクラ追加 + target_sb_main = "{ text: '🐎 マウント総合・全一覧', path: 'mounts/index.html' }," + replace_sb_main = "{ text: '🐎 マウント総合・全一覧', path: 'mounts/index.html' },\n { text: '🔨 ギャザクラ総合攻略・育成', path: 'crafter_gatherer/index.html' }," + if target_sb_main in content: + content = content.replace(target_sb_main, replace_sb_main, 1) + print("Updated sidebar main menu") + else: + print("target_sb_main not found!") + + # 3. sidebar に専用セクション追加 + crafter_section = ''' { + type: 'links', + title: '🔨 ギャザラー&クラフター', + links: [ + { text: 'ギャザクラ総合トップ・入門', path: 'crafter_gatherer/index.html' }, + { text: '爆速レベル上げロードマップ', path: 'crafter_gatherer/leveling_roadmap.html' }, + { text: 'リーヴ&GC調達納品攻略', path: 'crafter_gatherer/leves_gc_supply.html' }, + { text: '復興・オーシャン・お得意様', path: 'crafter_gatherer/ishgard_ocean_custom.html' }, + { text: '製作・採集おすすめマクロ', path: 'crafter_gatherer/macros.html' }, + { text: '全ギルド・主要NPC座標一覧', path: 'crafter_gatherer/npc_locations.html' } + ] + }, +''' + target_section = "{\n type: 'links',\n title: '🎮 XHB・操作設計'," + if target_section in content: + content = content.replace(target_section, crafter_section + " " + target_section, 1) + print("Added crafter_gatherer section to sidebar") + else: + # 改行の違いに対応 + pattern = r"(\{\s*type:\s*'links',\s*title:\s*'🎮 XHB・操作設計',)" + if re.search(pattern, content): + content = re.sub(pattern, crafter_section + r"\1", content, count=1) + print("Added crafter_gatherer section to sidebar via regex") + else: + print("target_section not found!") + + with open('common/js/wiki_common.js', 'w', encoding='utf-8') as f: + f.write(content) +else: + print("crafter_gatherer already in common/js/wiki_common.js")