diff --git a/picoblogger/blog/archive.html b/picoblogger/blog/archive.html new file mode 100644 index 0000000..47a512c --- /dev/null +++ b/picoblogger/blog/archive.html @@ -0,0 +1,127 @@ + + + + Mein Blog + + + + + + + + + + + + + + +
+

Mein Blog

Meine Worte, Meine Meinung ...

+
+ +
+
+

Artikel

+
+
+

Das ist der zweite Artikel

+
+
Autor
homer77
+
Erstellt am
24.02.2015 um 21:19 Uhr
+
Zuletzt geändert
08.03.2015 um 13:47 Uhr
+
+
+

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

+ +
+
+
+

Ein zweiter Test!

+
+
Autor
homer77
+
Erstellt am
15.02.2015 um 23:18 Uhr
+
Zuletzt geändert
08.03.2015 um 13:46 Uhr
+
+
+

Das ist ein weiter Testartikel

+

Ich muss das abschließen für heute

+

Klick mich

+
+

+
+
+
+
+

Dies ist ein Test

+
+
Autor
homer77
+
Erstellt am
15.02.2015 um 23:16 Uhr
+
Zuletzt geändert
08.03.2015 um 13:47 Uhr
+
+
+

Type your article right here.

+

You may use Markdown to format.

+ +
+ +
+ +
+ + + + diff --git a/picoblogger/blog/index.html b/picoblogger/blog/index.html index 59c13d5..47a512c 100644 --- a/picoblogger/blog/index.html +++ b/picoblogger/blog/index.html @@ -26,7 +26,7 @@

Navigation

@@ -35,130 +35,58 @@

Artikel

-

Using Seconds since Epoch as Unique ID for Permalinking

+

Das ist der zweite Artikel

Autor
homer77
-
Erstellt am
07.03.2015 um 23:08 Uhr
-
Zuletzt geändert
07.03.2015 um 22:15 Uhr
+
Erstellt am
24.02.2015 um 21:19 Uhr
+
Zuletzt geändert
08.03.2015 um 13:47 Uhr
-

My current idea regarding permalinking blog's articles is using seconds since epoche as a unique id which is defined at files creation.

+

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

-

The fifth article

+

Ein zweiter Test!

Autor
homer77
-
Erstellt am
07.03.2015 um 12:00 Uhr
-
Zuletzt geändert
07.03.2015 um 22:36 Uhr
+
Erstellt am
15.02.2015 um 23:18 Uhr
+
Zuletzt geändert
08.03.2015 um 13:46 Uhr
-

This article is directly published!

-

Without drafting and publishing.

+

Das ist ein weiter Testartikel

+

Ich muss das abschließen für heute

+

Klick mich

-

Fourth Article

+

Dies ist ein Test

Autor
homer77
-
Erstellt am
07.03.2015 um 11:06 Uhr
-
Zuletzt geändert
07.03.2015 um 22:36 Uhr
+
Erstellt am
15.02.2015 um 23:16 Uhr
+
Zuletzt geändert
08.03.2015 um 13:47 Uhr
-

That's odd. While on my other machine everything was in order now on the other one some variables are not substituted. Concretely dates and time are not displayed.

-

This article is ought to test if a newly created will work as intended.

+

Type your article right here.

+

You may use Markdown to format.

-
-
-
-

Third Article

-
-
Autor
homer77
-
Erstellt am
01.03.2015 um 19:35 Uhr
-
Zuletzt geändert
07.03.2015 um 22:35 Uhr
-
-
-

What about publication order?

-

I didn't care about pubdate yet ... nor the html5-tag neither the order of articles on this site. It should be ordered by date of creation - not by date of modification nor alphabetically.

- -
-
-
-

Second Article

-
-
Autor
homer77
-
Erstellt am
01.03.2015 um 19:26 Uhr
-
Zuletzt geändert
07.03.2015 um 22:35 Uhr
-
-
-

This is the second article.

-

How-To

-

Make a list

- -

Wuow! How come that it works now?!

- -

That`s unbelievable!

-
    -
  1. Maybe the paragraph was missing?
  2. -
  3. -

    Or there's sth wrong with the encoding? -2.1. Could it covariate with the fresh install of markdown?

    -
  4. -
  5. -

    This is

    -
  6. -
  7. a strange
  8. -
  9. situation
  10. -
- -
-
-
-

This is the first article

-
-
Autor
homer77
-
Erstellt am
01.03.2015 um 19:21 Uhr
-
Zuletzt geändert
07.03.2015 um 22:35 Uhr
-
-
-

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.

-
@@ -167,7 +95,7 @@

Übrigens ...

Letzte Artikel

diff --git a/picoblogger/blog/templates/nav.htm b/picoblogger/blog/templates/nav.htm index 216e6ac..53ecd8e 100644 --- a/picoblogger/blog/templates/nav.htm +++ b/picoblogger/blog/templates/nav.htm @@ -1,4 +1,4 @@ diff --git a/picoblogger/main.py b/picoblogger/main.py index 13a67a3..9acec39 100755 --- a/picoblogger/main.py +++ b/picoblogger/main.py @@ -79,6 +79,9 @@ tplDir = os.path.join(blog_dir,"templates") # path to drafts draftDir = os.path.join(blog_dir,"drafts") +# path to articles +articleDir = os.path.join(blog_dir,"articles") + # paths to configs pbconfpath = os.path.join("/","etc","picoblogger","pb.conf") # global config blogconfpath = os.path.join(blog_dir,"pb.conf") # local config @@ -160,8 +163,10 @@ def tags_to_html(tags): tag_list = tags.split(",") html_tags = "" sTAG = '#${TAG} ' - for tag in tag_list: - html_tags += Template(sTAG).safe_substitute({'TAG':tag}) + + if len(tag_list) > 0 and len(tag_list[0]) > 1: + for tag in tag_list: + html_tags += Template(sTAG).safe_substitute({'TAG':tag}) return html_tags @@ -244,7 +249,8 @@ def recent_articles(amount): dates_of_creation = [float(value) for value in articles_dict.keys()] dates_of_creation.sort(key=None,reverse=True) for i in range(0,amount): - joined_html += recent_to_html(articles_dict[str(time.strftime(str(dates_of_creation[i])))]) + if i < len(dates_of_creation): + joined_html += recent_to_html(articles_dict[str(time.strftime(str(dates_of_creation[i])))]) return joined_html @@ -255,6 +261,8 @@ def update_blog(subsection): tplIndex = os.path.join(tplDir,"index.htm") blogIndex = os.path.join(blog_dir,"index.html") + blogArchive = os.path.join(blog_dir,"archive.html") + tpl = Template(open(tplIndex,'r').read()) sNAV = open(os.path.join(tplDir,"nav.htm")).read() @@ -262,6 +270,7 @@ def update_blog(subsection): # sMAIN = open(os.path.join(tplDir,"main.htm")).read() # sMAIN = Template(sMAIN).safe_substitute(join_articles()) sMAIN = join_articles() + sARCHIVE = join_articles() sASIDE = open(os.path.join(tplDir,"aside.htm")).read() sRECENT = open(os.path.join(tplDir,"recent.htm")).read() @@ -302,6 +311,17 @@ def update_blog(subsection): with open(blogIndex,"w", encoding=l10nconf['BLOG_CHARSET']) as f: print(tmpIndex, file=f) + tplSub['TEMPLATE_MAIN'] = sARCHIVE + + tmpIndex = Template(tmpIndex).safe_substitute(tplSub) + + with open(blogArchive,"w", encoding=l10nconf['BLOG_CHARSET']) as f: + print(tmpIndex, file=f) + + + + + # def article_to_html(name): # article = os.path.join(blog_dir,"articles",name + ".txt") # txt = open(article).read() @@ -417,8 +437,10 @@ if vars(args)['target'] == 'article': ## list articles + if vars(args)['action'] == 'list': - pass + [print(item) for item in [os.path.splitext(item)[0] for item in os.listdir(articleDir) if not "~" in item]] + ## edit article