From f3169226c236a4554a8ad85d9083faa66db12d67 Mon Sep 17 00:00:00 2001 From: Homer Date: Sun, 1 Mar 2015 20:23:02 +0100 Subject: [PATCH] broken at this moment! Trying to get articles into order. The problem is that I only put date into article_dictionary but need the time also to sort articles by creation. --- picoblogger/blog/index.html | 53 +++++-------------------------------- picoblogger/main.py | 14 +++++++--- 2 files changed, 16 insertions(+), 51 deletions(-) diff --git a/picoblogger/blog/index.html b/picoblogger/blog/index.html index 0ab3ef5..9a0eb5b 100644 --- a/picoblogger/blog/index.html +++ b/picoblogger/blog/index.html @@ -35,58 +35,17 @@

Artikel

-

Ein zweiter Test!

+

This is the first article

Autor
homer77
-
Erstellt am
02/15/15
-
Zuletzt geändert
02/15/15
+
Erstellt am
03/01/15
+
Zuletzt geändert
03/01/15
-

Das ist ein weiter Testartikel

-

Ich muss das abschließen für heute

-

Klick mich

+

This is the first article in this blog. picoblogger supports basic features of markdown as tested on another instance.

+

Unfortunately it does not seem to work with list - neither ordererd nor unordered. But links actually do work fine.

-

-
-
-
-
-

Das ist der zweite Artikel

-
-
Autor
homer77
-
Erstellt am
02/24/15
-
Zuletzt geändert
02/24/15
-
-
-

Dies ist der zweite Test. -Ich schreibe verschiedene Zeilen Text und teste damit Markdown

-

Ist das jetzt ein neuer Absatz?

-

Und wie kann ich Code-Blöcke wie apt-get install einfügen? Funktioniert das mit 3 oder 4 Backticks?

-

Gehen auch -mehrere -Code-zeilen?

-

Und was ist mit Listen? -- Erster Eintrag -- Zweiter Eintrag -- Erster Untereintrag -- Dritter Eintrag

-
-

lustig,langweilig,blabla

-
-
-
-
-

Dies ist ein Test

-
-
Autor
homer77
-
Erstellt am
02/15/15
-
Zuletzt geändert
02/15/15
-
-
-

Type your article right here.

-

You may use Markdown to format.

-
diff --git a/picoblogger/main.py b/picoblogger/main.py index c389334..e546b5b 100755 --- a/picoblogger/main.py +++ b/picoblogger/main.py @@ -161,7 +161,7 @@ def article_to_html(article_dict): tplSub = { "ARTICLE_TITLE":article_dict['TITLE'], "ARTICLE_AUTHOR":article_dict['AUTHOR'], - "ARTICLE_CREATED":article_dict['DATE'], + "ARTICLE_CREATED":article_dict['DATE'], "ARTICLE_MODIFIED":article_dict['MODIFIED'], "ARTICLE_BODY":article_dict['BODY'], "ARTICLE_TAGS":article_dict['TAGS'] @@ -173,10 +173,16 @@ def article_to_html(article_dict): def join_articles(): artDir = os.path.join(blog_dir,"articles") joined_html = "" - + articles_dict = {} for name in [os.path.splitext(item)[0] for item in os.listdir(draftDir) if not "\~" in item]: - joined_html += article_to_html(parse_article(os.path.join(artDir, name + ".txt"))) - + article = (parse_article(os.path.join(artDir, name + ".txt"))) + time = time.strptime(article['DATE'] + " " + article['time'] + articles_dict[] = article + dates_of_creation = [value for value in articles_dict.keys()] + print(dates_of_creation) + for date in dates_of_creation: + joined_html += article_to_html(articles_dict[date]) + return joined_html def update_blog(subsection):