Added CSS handling and corrected an error with the cleaning of (added|modified|deleted)_files lists
This commit is contained in:
parent
b8becdbe30
commit
1e7dcbf6a2
7
TODO
7
TODO
@ -2,6 +2,11 @@ Finish gen.py -> RSS
|
|||||||
Recherche ?
|
Recherche ?
|
||||||
Pages par années / mois
|
Pages par années / mois
|
||||||
PARAMS
|
PARAMS
|
||||||
CSS
|
images etc.
|
||||||
Ignorer articles (en cours de rédaction)
|
Ignorer articles (en cours de rédaction)
|
||||||
What happen when a file is moved with git ?
|
What happen when a file is moved with git ?
|
||||||
|
|
||||||
|
Known bugs :
|
||||||
|
===========
|
||||||
|
On article / tag pages : links are relative and don't work
|
||||||
|
@titre not remplaced
|
||||||
|
@ -95,6 +95,7 @@ for changed_file in changes:
|
|||||||
for filename in list(added_files):
|
for filename in list(added_files):
|
||||||
if filename[:4] != "raw/":
|
if filename[:4] != "raw/":
|
||||||
added_files.remove(filename)
|
added_files.remove(filename)
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
int(filename[4:8])
|
int(filename[4:8])
|
||||||
@ -104,6 +105,7 @@ for filename in list(added_files):
|
|||||||
for filename in list(modified_files):
|
for filename in list(modified_files):
|
||||||
if filename[:4] != "raw/":
|
if filename[:4] != "raw/":
|
||||||
modified_files.remove(filename)
|
modified_files.remove(filename)
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
int(filename[4:6])
|
int(filename[4:6])
|
||||||
@ -113,6 +115,7 @@ for filename in list(modified_files):
|
|||||||
for filename in list(deleted_files):
|
for filename in list(deleted_files):
|
||||||
if filename[:4] != "raw/":
|
if filename[:4] != "raw/":
|
||||||
deleted_files.remove(filename)
|
deleted_files.remove(filename)
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
int(filename[4:6])
|
int(filename[4:6])
|
||||||
@ -268,6 +271,7 @@ try:
|
|||||||
header = header_fh.read()
|
header = header_fh.read()
|
||||||
tags_header = "<ul>"
|
tags_header = "<ul>"
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
|
print(tag)
|
||||||
tags_header += "<li><a href=\""+tag[4:-4]+".html\">"+tag[9:-4]+"</a></li>"
|
tags_header += "<li><a href=\""+tag[4:-4]+".html\">"+tag[9:-4]+"</a></li>"
|
||||||
tags_header += "</ul>"
|
tags_header += "</ul>"
|
||||||
header = header.replace("@categories", tags_header, 1)
|
header = header.replace("@categories", tags_header, 1)
|
||||||
@ -312,8 +316,18 @@ try:
|
|||||||
except IOError:
|
except IOError:
|
||||||
sys.exit("[ERROR] Unable to copy the footer.html file.")
|
sys.exit("[ERROR] Unable to copy the footer.html file.")
|
||||||
|
|
||||||
|
#Copy CSS files
|
||||||
|
if not os.path.isfile("raw/css") or list_directory("raw/css") == []:
|
||||||
|
print("[INFO] (CSS) No CSS files in raw/css folder")
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
shutil.copytree("raw/css", "blog/css")
|
||||||
|
except IOError:
|
||||||
|
sys.exit("[ERROR] An error occured while copying css files.")
|
||||||
|
|
||||||
|
|
||||||
#Regenerate index file
|
#Regenerate index file
|
||||||
last_25_articles = latest_articles("gen/", 25)
|
last_25_articles = latest_articles("gen/blog/2013/06/test.html", 25)
|
||||||
try:
|
try:
|
||||||
auto_dir("blog/index.html")
|
auto_dir("blog/index.html")
|
||||||
with open("blog/index.html", "w") as index_fh:
|
with open("blog/index.html", "w") as index_fh:
|
||||||
@ -336,7 +350,7 @@ except IOError:
|
|||||||
for tag in list_directory("gen/tags"):
|
for tag in list_directory("gen/tags"):
|
||||||
try:
|
try:
|
||||||
auto_dir(tag.replace("gen/", "blog/"))
|
auto_dir(tag.replace("gen/", "blog/"))
|
||||||
with open(tag.replace("gen/", "blog/"), "w") as tag_fh:
|
with open(tag.replace("gen/", "blog/")[:-4]+".html", "w") as tag_fh:
|
||||||
with open(tag, "r") as tag_gen_fh:
|
with open(tag, "r") as tag_gen_fh:
|
||||||
with open("gen/header.gen", "r") as header_fh:
|
with open("gen/header.gen", "r") as header_fh:
|
||||||
tag_content = header_fh.read()
|
tag_content = header_fh.read()
|
||||||
@ -349,7 +363,7 @@ for tag in list_directory("gen/tags"):
|
|||||||
with open("gen/footer.gen", "r") as footer_handler:
|
with open("gen/footer.gen", "r") as footer_handler:
|
||||||
tag_content += footer_handler.read()
|
tag_content += footer_handler.read()
|
||||||
tag_fh.write(tag_content)
|
tag_fh.write(tag_content)
|
||||||
print("[INFO] (TAGS) Tag page for "+tag+" has been generated successfully.")
|
print("[INFO] (TAGS) Tag page for "+tag[9:-4]+" has been generated successfully.")
|
||||||
except IOError:
|
except IOError:
|
||||||
sys.exit("[ERROR] An error occured while generating tag page \""+tag[9:-4]+"\"")
|
sys.exit("[ERROR] An error occured while generating tag page \""+tag[9:-4]+"\"")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user