From c20f7b3cedc878d90416cd3bf72f03d08ec1909c Mon Sep 17 00:00:00 2001 From: neodarz Date: Tue, 20 Jun 2017 19:12:18 +0200 Subject: Fix list order --- pyblog | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pyblog b/pyblog index f921f8d2..c4375564 100755 --- a/pyblog +++ b/pyblog @@ -309,7 +309,7 @@ def generate_menu(): # Generate the string who contain the links of the menu htmly_website_page = "" @@ -348,7 +348,7 @@ def generate_submenu(): # Generate the string who contain the links of the menu htmly_website_page = "" @@ -676,7 +676,7 @@ def generate_notes_list(): year = 10000 # will be larger than the latest year for quite a while # recall that entries are in reverse chronological order table_opened = False - for name in os.listdir(os.path.join(BUILDDIR, "notes")): + for name in list(reversed(sorted(os.listdir(os.path.join(BUILDDIR, "notes"))))): if re.match(r"^[0-9]{4}-[0-9]{2}-[0-9]{2}.*\.html", name): htmlpath = os.path.join(BUILDDIR, "notes", name) #tentry = AtomEntry() @@ -684,7 +684,6 @@ def generate_notes_list(): try: with open(htmlpath, encoding="utf-8") as htmlfile: soup = bs4.BeautifulSoup(htmlfile.read(), "lxml") - # generate atom entry #entry.author = copy.deepcopy(feed.author) # assume it's always the same author #entry_url = urllib.parse.urljoin(BLOG_HOME, "blog/%s" % name) @@ -701,7 +700,7 @@ def generate_notes_list(): post_date = soup.find("meta", attrs={"name": "date"})["content"] updated_datetime = dateutil.parser.parse(post_date) - date = updated_datetime + date = updated_datetime if date.year < year: # close the previous table if there is one if table_opened: -- cgit v1.2.1