feat: ヴァリガルマンダ討滅戦 完全攻略ページの作成およびリンク追加
This commit is contained in:
1 parent
049dd830e5
commit
90360961eb
5 files changed
+228
-17
No files matched your search
+15
-15
@@ -22,39 +22,39 @@ def clean_and_save(path, content):
|
||||
with open(path, 'wb') as f:
|
||||
f.write(b'\xef\xbb\xbf' + text.encode('utf-8'))
|
||||
|
||||
def update_ihuykatumu():
|
||||
# 1. dungeons/index.html
|
||||
path_idx = 'dungeons/index.html'
|
||||
def update_valigarmanda():
|
||||
# 1. trials/index.html
|
||||
path_idx = 'trials/index.html'
|
||||
with open(path_idx, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
if 'href="ihuykatumu.html"' not in c:
|
||||
if 'href="valigarmanda.html"' not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r'(イフイカ・トゥム</strong>.*?<td>)準備中(</td>)', r'\1<a href="ihuykatumu.html">攻略を見る ➜</a>\2', c, flags=re.DOTALL)
|
||||
c = re.sub(r'(ヴァリガルマンダ討滅戦</strong>.*?<td>)準備中(</td>)', r'\1<a href="valigarmanda.html">攻略を見る ➜</a>\2', c, flags=re.DOTALL)
|
||||
clean_and_save(path_idx, c)
|
||||
print("Updated ihuykatumu in dungeons/index.html")
|
||||
print("Updated valigarmanda in trials/index.html")
|
||||
|
||||
# 2. common/sidebar.html
|
||||
path_sb = 'common/sidebar.html'
|
||||
with open(path_sb, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
new_sb = '<li><a href="../dungeons/ihuykatumu.html">イフイカ・トゥム (Lv91)</a></li>'
|
||||
new_sb = '<li><a href="../trials/valigarmanda.html">ヴァリガルマンダ討滅戦 (Lv93)</a></li>'
|
||||
if new_sb not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r'(<li><a href="\.\./dungeons/tender_valley\.html">.*?</li>)', r'\1\n ' + new_sb, c)
|
||||
c = re.sub(r'(<li><a href="\.\./trials/ultima_weapon\.html">.*?</li>)', r'\1\n ' + new_sb, c)
|
||||
clean_and_save(path_sb, c)
|
||||
print("Added ihuykatumu to common/sidebar.html")
|
||||
print("Added valigarmanda to common/sidebar.html")
|
||||
|
||||
# 3. common/js/wiki_common.js
|
||||
path_js = 'common/js/wiki_common.js'
|
||||
with open(path_js, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
new_js = "{ text: 'イフイカ・トゥム (Lv91)', path: 'dungeons/ihuykatumu.html' }"
|
||||
if 'ihuykatumu.html' not in c:
|
||||
new_js = "{ text: 'ヴァリガルマンダ討滅戦 (Lv93)', path: 'trials/valigarmanda.html' }"
|
||||
if 'valigarmanda.html' not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r"(\{ text: 'サボテンダーバレー \(Lv100\)', path: 'dungeons/tender_valley\.html' \})", r"\1,\n " + new_js, c)
|
||||
c = re.sub(r"(\{ text: 'アルテマウェポン破壊作戦 \(Lv50\)', path: 'trials/ultima_weapon\.html' \})", r"\1,\n " + new_js, c)
|
||||
clean_and_save(path_js, c)
|
||||
print("Added ihuykatumu to common/js/wiki_common.js")
|
||||
print("Added valigarmanda to common/js/wiki_common.js")
|
||||
|
||||
if __name__ == '__main__':
|
||||
clean_and_save('dungeons/ihuykatumu.html', open('dungeons/ihuykatumu.html', 'r', encoding='utf-8', errors='ignore').read())
|
||||
update_ihuykatumu()
|
||||
clean_and_save('trials/valigarmanda.html', open('trials/valigarmanda.html', 'r', encoding='utf-8', errors='ignore').read())
|
||||
update_valigarmanda()
|
||||
Reference in new issue
Block a user