From a4e9772f25d7683575c7eae70c654fa2aab46091 Mon Sep 17 00:00:00 2001 From: Phyks Date: Sat, 27 Jul 2013 21:08:13 +0200 Subject: [PATCH] Bug correction and old code left deleted --- pre-commit.py | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/pre-commit.py b/pre-commit.py index f90f275..a72b2a0 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -430,7 +430,7 @@ tags_full_list = list_directory("gen/tags") for filename in added_files+modified_files: try: with open(filename, 'r') as fh: - article = "", "", "", "", "" + article, title, date, author, tags = "", "", "", "", "" for line in fh.readlines(): article += line if "@title=" in line: @@ -630,36 +630,6 @@ for tag in tags_full_list: sys.exit("[ERROR] An error occurred while generating tag page \"" + tag[9:-4]+"\"") -# Finish articles pages generation -for filename in added_files+modified_files: - try: - auto_dir("blog/"+filename[4:]) - with open("blog/"+filename[4:], "w") as article_fh: - with open("gen/header.gen", "r") as header_gen_fh: - article = header_gen_fh.read() - with open("gen/"+filename[4:-5]+".gen", "r") as article_gen_fh: - line = article_gen_fh.readline() - while "@title" not in line: - line = article_gen_fh.readline() - line = line.strip() - title_pos = line.find("@title=") - title = line[title_pos+7:] - article_gen_fh.seek(0) - - article = article.replace("@title", params["BLOG_TITLE"] + - " - "+title, 1) - article += replace_tags(article_gen_fh.read(), - search_list, - replace_list) - with open("gen/footer.gen", "r") as footer_gen_fh: - article += footer_gen_fh.read() - article_fh.write(article) - print("[INFO] (ARTICLES) Article page for "+filename[4:] + - " has been generated successfully.") - except IOError: - sys.exit("[ERROR] An error occurred while generating article " + - filename[4:]+" page.") - # Regenerate page for years / months years_list.sort(reverse=True) for i in years_list: