diff --git a/TODO b/TODO index cc16539..64fde97 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ Finish gen.py -> RSS Recherche ? Pages par années / mois -images etc. -Ignorer articles (en cours de rédaction) What happen when a file is moved with git ? Flake8 the whole thing ! :) diff --git a/pre-commit.py b/pre-commit.py index 05361c6..bd9a6e9 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -108,6 +108,19 @@ for filename in list(added_files): int(filename[4:8]) except ValueError: added_files.remove(filename) + continue + + if filename[-4:] != "html" and filename[-6:] != "ignore": + print("[INFO] (Not HTML file) Copying directly not html file "+filename[4:]+" to blog dir.") + auto_dir("blog/"+filename[4:]) + shutil.copy(filename, "blog/"+filename[4:]) + added_files.remove(filename) + continue + + if filename[-6:] == "ignore": + print("[INFO] (Not published) Found not published article "+filename[4:-7]+".") + added_files.remove(filename) + continue for filename in list(modified_files): if filename[:4] != "raw/": @@ -118,6 +131,19 @@ for filename in list(modified_files): int(filename[4:6]) except ValueError: modified_files.remove(filename) + continue + + if filename[-4:] != "html" and filename[-6:] != "ignore": + print("[INFO] (Not HTML file) Updating directly not html file "+filename[4:]+" to blog dir.") + auto_dir("blog/"+filename[4:]) + shutil.copy(filename, "blog/"+filename[4:]) + modified_files.remove(filename) + continue + + if filename[-6:] == "ignore": + print("[INFO] (Not published) Found not published article "+filename[4:-7]+".") + added_files.remove(filename) + continue for filename in list(deleted_files): if filename[:4] != "raw/": @@ -128,7 +154,19 @@ for filename in list(deleted_files): int(filename[4:6]) except ValueError: deleted_files.remove(filename) + continue + if filename[-4:] != "html" and filename[-6:] != "ignore": + print("[INFO] (Not HTML file) Copying directly not html file "+filename[4:]+" to blog dir.") + auto_dir("blog/"+filename[4:]) + shutil.copy(filename, "blog/"+filename[4:]) + deleted_files.remove(filename) + continue + + if filename[-6:] == "ignore": + print("[INFO] (Not published) Found not published article "+filename[4:-7]+".") + added_files.remove(filename) + continue print("[INFO] Added files : "+", ".join(added_files))