44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
import os
|
|
import re
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
with open('tools/test_extract.py', 'r', encoding='utf-8') as fp:
|
|
code = fp.read()
|
|
|
|
# extract_content 関数定義部分をそのまま利用
|
|
exec(code[:code.find("test_files = [")])
|
|
|
|
unknown_files = []
|
|
success_count = 0
|
|
|
|
with open('tools/list_non_conforming_pages.py', 'r', encoding='utf-8') as fp:
|
|
lines = fp.readlines()
|
|
|
|
for root, dirs, files in os.walk('.'):
|
|
if '.git' in root or 'node_modules' in root:
|
|
continue
|
|
for f in files:
|
|
if f.endswith('.html'):
|
|
path = os.path.join(root, f).replace('\\', '/')
|
|
if path in ['./common/header.html', './common/sidebar.html', './common/templates/dungeon_raid_template.html']:
|
|
continue
|
|
with open(path, 'r', encoding='utf-8', errors='ignore') as fp:
|
|
content = fp.read()
|
|
has_iframe_header = 'wiki-header-frame' in content
|
|
has_iframe_sidebar = 'wiki-sidebar-frame' in content
|
|
if not (has_iframe_header and has_iframe_sidebar):
|
|
t, d, c, pattern = extract_content(content)
|
|
if pattern == "UNKNOWN" or not c:
|
|
unknown_files.append(path)
|
|
else:
|
|
success_count += 1
|
|
|
|
print(f"抽出成功ファイル数: {success_count} / {success_count + len(unknown_files)}")
|
|
print(f"抽出失敗ファイル数: {len(unknown_files)}")
|
|
if unknown_files:
|
|
print("失敗ファイル一覧:")
|
|
for uf in unknown_files:
|
|
print(uf)
|