From e83f5fb60a3caa4028e7747b967165b7a9139d80 Mon Sep 17 00:00:00 2001 From: "kiasoc5@disroot.org" Date: Tue, 10 May 2022 18:04:21 -0400 Subject: [PATCH] Create index.html as symlink to Main_page.html fixes #2 --- arch-wiki-docs.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch-wiki-docs.py b/arch-wiki-docs.py index 2903f46..b05c414 100755 --- a/arch-wiki-docs.py +++ b/arch-wiki-docs.py @@ -3,6 +3,7 @@ import datetime import argparse import sys +import os from simplemediawiki import build_user_agent @@ -42,5 +43,16 @@ downloader.download_images() + for f in os.listdir(args.output_directory): + lang_dir = os.path.join(args.output_directory, f) + if os.path.isdir(lang_dir): + main_page = os.path.join(lang_dir, "Main_page.html") + index_html = os.path.join(lang_dir, "index.html") + if os.path.exists(main_page) and not os.path.exists(index_html): + print("Symlink", index_html, "->", main_page) + os.symlink("Main_page.html", index_html) + else: + print(main_page, "exists, skipping") + if args.clean: downloader.clean_output_directory()