Not HTML files + Not published articles

Added the ability to handle not HTML files (such as images, directly copied in the blog folder) and not published articles (by the use of .ignore extension in filename)
This commit is contained in:
Phyks 2013-07-22 11:13:34 +02:00
parent 2447c12e3f
commit 5b7dad4a78
2 changed files with 38 additions and 2 deletions

2
TODO
View File

@ -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 ! :)

View File

@ -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))