articles are in order and now can be created immediately without drafting.
Footer and aside region are now templated which made templating a bit more complicated. At this moment I'm not sure how to deal with the 'recent' feature which could link to most recent articles. One could show last 5, only the last created and the last modified etc. But as the blog is not dynamic linking could be tricky ... I could use anchors to jump to certain articles but this doesn't solve that there will be no permalink ... Have to rethink this ...
This commit is contained in:
parent
54e43ba175
commit
f5ec071692
|
@ -35,69 +35,149 @@
|
||||||
<h1>Artikel</h1>
|
<h1>Artikel</h1>
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1>Das ist der zweite Artikel</h1>
|
<h1>The fifth article</h1>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Autor</dt><dd>homer77</dd>
|
<dt>Autor</dt><dd>homer77</dd>
|
||||||
<dt>Erstellt am</dt><dd>02/24/15 21:19:45</dd>
|
<dt>Erstellt am</dt><dd>03/07/15 12:00:55</dd>
|
||||||
<dt>Zuletzt geändert</dt><dd>02/24/15 20:57:37</dd>
|
<dt>Zuletzt geändert</dt><dd>03/07/15 11:03:18</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</header>
|
</header>
|
||||||
<p>Dies ist der zweite Test.
|
<h2>This article is directly published!</h2>
|
||||||
Ich schreibe verschiedene Zeilen Text und teste damit <strong>Markdown</strong></p>
|
<p>Without drafting and publishing.</p>
|
||||||
<p>Ist das jetzt ein neuer <em>Absatz</em>?</p>
|
|
||||||
<p>Und wie kann ich Code-Blöcke wie <code>apt-get install</code> einfügen? Funktioniert das mit 3 oder 4 Backticks?</p>
|
|
||||||
<p><code>Gehen auch
|
|
||||||
mehrere
|
|
||||||
Code-zeilen?</code></p>
|
|
||||||
<p>Und was ist mit Listen?
|
|
||||||
- Erster Eintrag
|
|
||||||
- Zweiter Eintrag
|
|
||||||
- Erster Untereintrag
|
|
||||||
- Dritter Eintrag</p>
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>lustig,langweilig,blabla</p>
|
<p>direct,article,nodraft</p>
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1>Ein zweiter Test!</h1>
|
<h1>Fourth Article</h1>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Autor</dt><dd>homer77</dd>
|
<dt>Autor</dt><dd>homer77</dd>
|
||||||
<dt>Erstellt am</dt><dd>02/15/15 23:18:22</dd>
|
<dt>Erstellt am</dt><dd>03/07/15 11:06:07</dd>
|
||||||
<dt>Zuletzt geändert</dt><dd>02/15/15 22:19:30</dd>
|
<dt>Zuletzt geändert</dt><dd>03/07/15 10:10:50</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</header>
|
</header>
|
||||||
<h1>Das ist ein weiter Testartikel</h1>
|
<p>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.</p>
|
||||||
<h2>Ich muss das abschließen für heute</h2>
|
<p><strong>This</strong> article is ought to test if a newly created will work as intended.</p>
|
||||||
<p><a href="https://example.org">Klick mich</a></p>
|
|
||||||
<footer>
|
<footer>
|
||||||
<p> </p>
|
<p>bug,date,templating</p>
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1>Dies ist ein Test</h1>
|
<h1>Third Article</h1>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Autor</dt><dd>homer77</dd>
|
<dt>Autor</dt><dd>homer77</dd>
|
||||||
<dt>Erstellt am</dt><dd>02/15/15 23:16:34</dd>
|
<dt>Erstellt am</dt><dd>03/01/15 19:35:06</dd>
|
||||||
<dt>Zuletzt geändert</dt><dd>02/15/15 22:18:03</dd>
|
<dt>Zuletzt geändert</dt><dd>03/01/15 18:37:35</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</header>
|
</header>
|
||||||
<h1>Type your article <em>right here</em>.</h1>
|
<h2>What about publication order?</h2>
|
||||||
<p>You may use <em>Markdown</em> to format.</p>
|
<p>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.</p>
|
||||||
<footer>
|
<footer>
|
||||||
<p>test,picoblogger,coden</p>
|
<p>order, feature, bug</p>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<h1>Second Article</h1>
|
||||||
|
<dl>
|
||||||
|
<dt>Autor</dt><dd>homer77</dd>
|
||||||
|
<dt>Erstellt am</dt><dd>03/01/15 19:26:35</dd>
|
||||||
|
<dt>Zuletzt geändert</dt><dd>03/01/15 18:34:20</dd>
|
||||||
|
</dl>
|
||||||
|
</header>
|
||||||
|
<p>This is the second article.</p>
|
||||||
|
<h2>How-To</h2>
|
||||||
|
<h3>Make a list</h3>
|
||||||
|
<ul>
|
||||||
|
<li>is this a list?</li>
|
||||||
|
<li>
|
||||||
|
<p>or this?</p>
|
||||||
|
<ul>
|
||||||
|
<li>or this?</li>
|
||||||
|
<li>or that?</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>or must</p>
|
||||||
|
</li>
|
||||||
|
<li>indention be like this?</li>
|
||||||
|
</ul>
|
||||||
|
<p>Wuow! How come that it works now?!</p>
|
||||||
|
<ul>
|
||||||
|
<li>nobody knows</li>
|
||||||
|
<li>
|
||||||
|
<p>I see trouble</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>nobody knows</p>
|
||||||
|
</li>
|
||||||
|
<li>but Jesus.</li>
|
||||||
|
</ul>
|
||||||
|
<p>That`s unbelievable!</p>
|
||||||
|
<ol>
|
||||||
|
<li>Maybe the paragraph was missing?</li>
|
||||||
|
<li>
|
||||||
|
<p>Or there's sth wrong with the encoding?
|
||||||
|
2.1. Could it covariate with the fresh install of markdown?</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>This is</p>
|
||||||
|
</li>
|
||||||
|
<li>a strange</li>
|
||||||
|
<li>situation</li>
|
||||||
|
</ol>
|
||||||
|
<footer>
|
||||||
|
<p>picoblogger, test, how-to</p>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<h1>This is the first article</h1>
|
||||||
|
<dl>
|
||||||
|
<dt>Autor</dt><dd>homer77</dd>
|
||||||
|
<dt>Erstellt am</dt><dd>03/01/15 19:21:24</dd>
|
||||||
|
<dt>Zuletzt geändert</dt><dd>03/01/15 18:24:21</dd>
|
||||||
|
</dl>
|
||||||
|
</header>
|
||||||
|
<p>This is the <em>first article</em> in this blog. <strong>picoblogger</strong> supports basic features of markdown as tested on another instance.</p>
|
||||||
|
<p>Unfortunately it does not seem to work with list - neither ordererd nor unordered. But <a href="http://localhost">links</a> actually do work fine.</p>
|
||||||
|
<footer>
|
||||||
|
<p>notags</p>
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<aside class="flex-item">
|
<aside class="flex-item">
|
||||||
<h1>By the way ...</h1>
|
<h1>Übrigens ...</h1>
|
||||||
|
<h2>Letzte Artikel</h2>
|
||||||
|
<ul>
|
||||||
|
${RECENT_ARTICLES}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Kontakt</h2>
|
||||||
|
<dl class="contact">
|
||||||
|
<dt>E-Mail</dt>
|
||||||
|
<dd>any@mail.address.org</dd>
|
||||||
|
<dt>Diaspora</dt>
|
||||||
|
<dd>youraccount@anypod.org</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<h1>Das Beste zum Schluss</h1>
|
<h1>Appendix</h1>
|
||||||
|
<dl>
|
||||||
|
<dt>powered with:</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/maste9/picoblogger">picoblogger</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -9,7 +9,16 @@ TEMPLATE_ARTICLE_AUTHOR = Autor
|
||||||
TEMPLATE_ARTICLE_CREATED = Erstellt am
|
TEMPLATE_ARTICLE_CREATED = Erstellt am
|
||||||
TEMPLATE_ARTICLE_MODIFIED = Zuletzt geändert
|
TEMPLATE_ARTICLE_MODIFIED = Zuletzt geändert
|
||||||
|
|
||||||
|
ASIDE_TITLE = Übrigens ...
|
||||||
|
RECENT_TITLE = Letzte Artikel
|
||||||
|
CONTACT_TITLE = Kontakt
|
||||||
|
CONTACT_MAIL_TITLE = E-Mail
|
||||||
|
CONTACT_SOCIAL_TITLE = Diaspora
|
||||||
|
|
||||||
NAV_TITLE = Navigation
|
NAV_TITLE = Navigation
|
||||||
HOME_BUTTON = Aktuell
|
HOME_BUTTON = Aktuell
|
||||||
ARCHIVE_BUTTON = Archiv
|
ARCHIVE_BUTTON = Archiv
|
||||||
BLOG_CHARSET = utf-8
|
BLOG_CHARSET = utf-8
|
||||||
|
|
||||||
|
FOOTER_TITLE = Appendix
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,6 @@
|
||||||
BLOG_TITLE = Mein Blog
|
BLOG_TITLE = Mein Blog
|
||||||
BLOG_SUBTITLE = Meine Worte, Meine Meinung ... # Das ist ein Kommentar zum Testen
|
BLOG_SUBTITLE = Meine Worte, Meine Meinung ... # Das ist ein Kommentar zum Testen
|
||||||
BLOG_LANG = de
|
BLOG_LANG = de
|
||||||
|
|
||||||
|
CONTACT_MAIL_ADDRESS = any@mail.address.org
|
||||||
|
CONTACT_SOCIAL_ADDRESS = youraccount@anypod.org
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
<h1>By the way ...</h1>
|
<h1>${ASIDE_TITLE}</h1>
|
||||||
|
${ASIDE_RECENT}
|
||||||
|
|
||||||
|
${ASIDE_CONTACT}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<h2>${CONTACT_TITLE}</h2>
|
||||||
|
<dl class="contact">
|
||||||
|
<dt>${CONTACT_MAIL_TITLE}</dt>
|
||||||
|
<dd>${CONTACT_MAIL_ADDRESS}</dd>
|
||||||
|
<dt>${CONTACT_SOCIAL_TITLE}</dt>
|
||||||
|
<dd>${CONTACT_SOCIAL_ADDRESS}</dd>
|
||||||
|
</dl>
|
|
@ -1 +1,9 @@
|
||||||
<h1>Das Beste zum Schluss</h1>
|
<h1>${FOOTER_TITLE}</h1>
|
||||||
|
<dl>
|
||||||
|
<dt>powered with:</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/maste9/picoblogger">picoblogger</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<h2>${RECENT_TITLE}</h2>
|
||||||
|
<ul>
|
||||||
|
${RECENT_ARTICLES}
|
||||||
|
</ul>
|
|
@ -177,7 +177,7 @@ def join_articles():
|
||||||
artDir = os.path.join(blog_dir,"articles")
|
artDir = os.path.join(blog_dir,"articles")
|
||||||
joined_html = ""
|
joined_html = ""
|
||||||
articles_dict = {}
|
articles_dict = {}
|
||||||
for name in [os.path.splitext(item)[0] for item in os.listdir(draftDir) if not "\~" in item]:
|
for name in [os.path.splitext(item)[0] for item in os.listdir(artDir) if not "\~" in item]:
|
||||||
article = (parse_article(os.path.join(artDir, name + ".txt")))
|
article = (parse_article(os.path.join(artDir, name + ".txt")))
|
||||||
# Bring articles into chronological order
|
# Bring articles into chronological order
|
||||||
t = time.mktime(time.strptime(article['DATE'] + " " + article['TIME'],"%m/%d/%y %H:%M:%S"))
|
t = time.mktime(time.strptime(article['DATE'] + " " + article['TIME'],"%m/%d/%y %H:%M:%S"))
|
||||||
|
@ -188,6 +188,7 @@ def join_articles():
|
||||||
joined_html += article_to_html(articles_dict[str(time.strftime(str(date)))])
|
joined_html += article_to_html(articles_dict[str(time.strftime(str(date)))])
|
||||||
|
|
||||||
return joined_html
|
return joined_html
|
||||||
|
|
||||||
|
|
||||||
def update_blog(subsection):
|
def update_blog(subsection):
|
||||||
# Joins config defined variables into templates
|
# Joins config defined variables into templates
|
||||||
|
@ -196,12 +197,6 @@ def update_blog(subsection):
|
||||||
blogIndex = os.path.join(blog_dir,"index.html")
|
blogIndex = os.path.join(blog_dir,"index.html")
|
||||||
|
|
||||||
tpl = Template(open(tplIndex,'r').read())
|
tpl = Template(open(tplIndex,'r').read())
|
||||||
tmpIndex = tpl.safe_substitute(l10nconf)
|
|
||||||
|
|
||||||
if blogconf:
|
|
||||||
tmpIndex = Template(tmpIndex).safe_substitute(blogconf)
|
|
||||||
if pbconf:
|
|
||||||
tmpIndex = Template(tmpIndex).safe_substitute(pbconf)
|
|
||||||
|
|
||||||
sNAV = open(os.path.join(tplDir,"nav.htm")).read()
|
sNAV = open(os.path.join(tplDir,"nav.htm")).read()
|
||||||
sNAV = Template(sNAV).safe_substitute(l10nconf)
|
sNAV = Template(sNAV).safe_substitute(l10nconf)
|
||||||
|
@ -209,8 +204,33 @@ def update_blog(subsection):
|
||||||
# sMAIN = Template(sMAIN).safe_substitute(join_articles())
|
# sMAIN = Template(sMAIN).safe_substitute(join_articles())
|
||||||
sMAIN = join_articles()
|
sMAIN = join_articles()
|
||||||
sASIDE = open(os.path.join(tplDir,"aside.htm")).read()
|
sASIDE = open(os.path.join(tplDir,"aside.htm")).read()
|
||||||
|
|
||||||
|
sRECENT = open(os.path.join(tplDir,"recent.htm")).read()
|
||||||
|
sCONTACT = open(os.path.join(tplDir,"contact.htm")).read()
|
||||||
sFOOTER = open(os.path.join(tplDir,"footer.htm")).read()
|
sFOOTER = open(os.path.join(tplDir,"footer.htm")).read()
|
||||||
|
|
||||||
|
tmpIndex = tpl.safe_substitute(l10nconf)
|
||||||
|
sASIDE = Template(sASIDE).safe_substitute(l10nconf)
|
||||||
|
sCONTACT = Template(sCONTACT).safe_substitute(l10nconf)
|
||||||
|
sRECENT = Template(sRECENT).safe_substitute(l10nconf)
|
||||||
|
sFOOTER = Template(sFOOTER).safe_substitute(l10nconf)
|
||||||
|
|
||||||
|
if blogconf:
|
||||||
|
tmpIndex = Template(tmpIndex).safe_substitute(blogconf)
|
||||||
|
sASIDE = Template(sASIDE).safe_substitute(blogconf)
|
||||||
|
sCONTACT = Template(sCONTACT).safe_substitute(blogconf)
|
||||||
|
sRECENT = Template(sRECENT).safe_substitute(blogconf)
|
||||||
|
sFOOTER = Template(sFOOTER).safe_substitute(blogconf)
|
||||||
|
if pbconf:
|
||||||
|
tmpIndex = Template(tmpIndex).safe_substitute(pbconf)
|
||||||
|
sASIDE = Template(sASIDE).safe_substitute(pbconf)
|
||||||
|
sCONTACT = Template(sCONTACT).safe_substitute(pbconf)
|
||||||
|
sRECENT = Template(sRECENT).safe_substitute(pbconf)
|
||||||
|
sFOOTER = Template(sFOOTER).safe_substitute(pbconf)
|
||||||
|
|
||||||
|
|
||||||
|
sASIDE = Template(sASIDE).safe_substitute({"ASIDE_RECENT":sRECENT, "ASIDE_CONTACT":sCONTACT})
|
||||||
|
|
||||||
tplSub = {
|
tplSub = {
|
||||||
"TEMPLATE_NAV":sNAV,
|
"TEMPLATE_NAV":sNAV,
|
||||||
"TEMPLATE_MAIN":sMAIN,
|
"TEMPLATE_MAIN":sMAIN,
|
||||||
|
@ -322,7 +342,18 @@ if vars(args)['target'] == 'article':
|
||||||
|
|
||||||
## add new article
|
## add new article
|
||||||
if vars(args)['action'] == 'add':
|
if vars(args)['action'] == 'add':
|
||||||
pass
|
article = os.path.join(blog_dir,"articles",vars(args)['name'] + ".txt")
|
||||||
|
tpl = os.path.join(tplDir,"article.tpl")
|
||||||
|
sTpl = open(tpl).read()
|
||||||
|
subs = {"DATE" : time.strftime("%x",time.localtime()), "TIME" : time.strftime("%X",time.localtime()),
|
||||||
|
"AUTHOR" : user
|
||||||
|
}
|
||||||
|
|
||||||
|
sTpl = Template(sTpl).safe_substitute(subs)
|
||||||
|
with open(article,"w", encoding=l10nconf['BLOG_CHARSET']) as f:
|
||||||
|
print(sTpl, file=f)
|
||||||
|
|
||||||
|
subprocess.call(["emacs", "-nw", article])
|
||||||
|
|
||||||
|
|
||||||
## list articles
|
## list articles
|
||||||
|
|
Loading…
Reference in New Issue