clean_translations: update for VitePress

This commit is contained in:
lifehackerhansol 2024-09-28 14:53:28 -07:00
parent 95cb1f6894
commit 361f4c0e57
No known key found for this signature in database
GPG Key ID: 80FB184AFC0B3B0E

View File

@ -5,21 +5,25 @@ files_in_main = []
files_in_main_include = [] files_in_main_include = []
for i in os.listdir("_pages/en_US/"): for i in os.listdir("docs"):
files_in_main.append(i) if i.endswith(".md"):
files_in_main.append(i)
for i in os.listdir("_pages/en_US/include"): for i in os.listdir("docs/_include"):
files_in_main_include.append(i) if i.endswith(".md"):
files_in_main_include.append(i)
for i in os.listdir("_pages/"): for i in os.listdir("docs"):
if i == "en_US": if not os.path.isdir(f"docs/{i}"):
continue continue
for j in os.listdir(f"_pages/{i}"): if i in [".vitepress", "public", "_include", "_internal"]:
if j == "include": continue
for k in os.listdir(f"_pages/{i}/include"): for j in os.listdir(f"docs/{i}"):
if j == "_include":
for k in os.listdir(f"docs/{i}/_include"):
if k not in files_in_main_include: if k not in files_in_main_include:
print(f"Deleting _pages/{i}/include/{k}") print(f"Deleting docs/{i}/_include/{k}")
os.remove(f"_pages/{i}/include/{k}") os.remove(f"docs/{i}/_include/{k}")
elif j not in files_in_main: elif j not in files_in_main:
print(f"Deleting _pages/{i}/{j}") print(f"Deleting docs/{i}/{j}")
os.remove(f"_pages/{i}/{j}") os.remove(f"docs/{i}/{j}")