diff --git a/pre-commit.py b/pre-commit.py index 0ad23c2..78256cd 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -755,16 +755,16 @@ rss = ("\n") if os.path.isfile("raw/rss.css"): rss += ("\n") + "href=\""+params["PROTOCOL"]+params["BLOG_URL"]+"/rss.css\"?>\n") rss += ("\n") rss += ("\t" - "\t\t\n" + "\t\t\n" "\t\t"+params["BLOG_TITLE"]+"\n" - "\t\t"+params["BLOG_URL"]+"\n" + "\t\t"+params["PROTOCOL"] + params["BLOG_URL"]+"\n" "\t\t"+params["DESCRIPTION"]+"\n" "\t\t"+params["LANGUAGE"]+"\n" "\t\t"+params["COPYRIGHT"]+"\n" @@ -812,10 +812,10 @@ for i, article in enumerate(["gen/"+x[4:-5]+".gen" for x in last_articles]): rss += ("\t\t\n" "\t\t\t"+remove_tags(title)+"\n" - "\t\t\t"+params["BLOG_URL"]+"/" + + "\t\t\t"+params["PROTOCOL"]+params["BLOG_URL"]+"/" + article[4:-4]+".html\n" + "\t\t\t" + - params["BLOG_URL"]+"/"+article[4:-4]+"\n" + params["PROTOCOL"] + params["BLOG_URL"]+"/"+article[4:-4]+"\n" "\t\t\t\n" @@ -878,11 +878,17 @@ for tag in tags_full_list: tag_content = header.replace("@title", params["BLOG_TITLE"] + " - "+tag[4:-4], 1) + # Sort by date with open(tag, "r") as tag_gen_fh: - for line in tag_gen_fh.readlines(): - line = line.replace(".html", ".gen") - with open("gen/"+line.strip(), "r") as article_fh: - tag_content += article_fh.read() + articles_list = ["gen/"+line.replace(".html", ".gen").strip() for line + in tag_gen_fh.readlines()] + articles_list.sort(key=lambda x: (get_date(x)[4:8], get_date(x)[2:4], + get_date(x)[:2], get_date(x)[9:]), + reverse=True) + + for article in articles_list: + with open(article.strip(), "r") as article_fh: + tag_content += article_fh.read() tag_content += footer try: @@ -941,7 +947,10 @@ for i in years_list: params["BLOG_TITLE"]+" - "+i+"/"+j, 1) articles_list = list_directory("gen/"+i+"/"+j) - articles_list.sort(key=lambda x: get_date(x), reverse=True) + articles_list.sort(key=lambda x: (get_date(x)[4:8], get_date(x)[2:4], + get_date(x)[:2], get_date(x)[9:]), + reverse=True) + for article in articles_list: try: with open(article, "r") as article_fh: diff --git a/raw/params b/raw/params index 1668af4..4fa0c7e 100644 --- a/raw/params +++ b/raw/params @@ -1,6 +1,7 @@ BLOG_TITLE = Blog NB_ARTICLES_INDEX = 20 BLOG_URL = #BLOG_URL +PROTOCOL = http IGNORE_FILES =