From 9aec5ab42e89f80c4abde62d81fc5fc6356582b9 Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Sat, 21 Jan 2012 17:52:57 +0100 Subject: * Add sidebar * Fix style issues * Import stuff from my private design --- blogthon.cgi | 95 +++++++++++++++++++++++++++++++--------------- styles/default/default.css | 41 ++++++++++---------- styles/default/header.txt | 1 + 3 files changed, 85 insertions(+), 52 deletions(-) create mode 100644 styles/default/header.txt diff --git a/blogthon.cgi b/blogthon.cgi index f46c311..d73fda0 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -26,6 +26,7 @@ from glob import glob from random import randint from codecs import getwriter from optparse import OptionParser +from operator import itemgetter # print() will output ascii, but we want utf-8 (python3) try: @@ -121,6 +122,8 @@ try: comments = configuration.get("look", "comments") newest_first = configuration.get("look", "newest_first") tags = configuration.get("look", "tags") + taglist = configuration.get("look", "taglist") + tags_max = configuration.get("look", "tags_max") new_comment_mail = configuration.get("smtp", "new_comment_mail") mail_to = configuration.get("smtp", "mail_to") smtp_host = configuration.get("smtp", "smtp_host") @@ -161,7 +164,8 @@ if language == "de": "Text", "Absenden", "Neuer Kommentar zu", - "Jemand hat einen Kommentar zu diesem Beitrag verfasst:" + "Jemand hat einen Kommentar zu diesem Beitrag verfasst:", + "Tags" ) locales_de = ("de_DE.UTF-8", "de_DE.@euro", "de_DE") for i in locales_de: @@ -183,7 +187,8 @@ else: "View all entries...", "name", "text", "commit", "New comment on", - "Someone wrote a comment to this entry:" + "Someone wrote a comment to this entry:", + "tags" ) locales_en = ("en_US.UTF-8", "en_US.ISO-8859-15", "en_US") for i in locales_en: @@ -477,7 +482,6 @@ else: print(ind + "") print(ind + "") - print("") # Plugins sys.path.append(plugins_dir) @@ -534,35 +538,18 @@ else: print(ind*5 + "
  • %s
  • " % (link, title)) print(ind*4 + "") print(ind*3 + "") - print(ind*3 + "
    ") print(ind*2 + "") print("") - # Monthlist - if monthlist == "True": - olddate = "" - print(ind*2 + "
    ") - print(ind*3 + "
    %s
    " % blog_locale[1]) - print(ind*3 + "
    ") - print(ind*4 + "
      ") - for entry in entries: - date = time.strftime("%m%Y", entry[0]) - date_display = time.strftime("%h %Y", entry[0]) - if not olddate == date: - print(ind*5 + "
    • %s
    • " % (date, date_display)) - olddate = date - print(ind*4 + "
    ") - print(ind*3 + "
    ") - print(ind*3 + "
    ") - print(ind*2 + "
    ") - print("") + # Sidebar starts here + print(ind*2 + "
    ") # Linklist if linklist == "True": - print(ind*2 + "
    ") - print(ind*3 + "" % blog_locale[2]) - print(ind*3 + "") print(ind*3 + "
    ") - print(ind*3 + "") - print(ind*2 + "
    ") print("") + # Taglist + if taglist == "True": + print(ind*3 + "
    ") + print(ind*4 + "
    %s
    " % blog_locale[11]) + print(ind*4 + "
    ") + print(ind*5 + "
      ") + tagfile = open(os.path.join(entries_dir, "tags"), "r") + content = pickle.load(tagfile) + tagfile.close() + taglist = [] + for item in content: + taglist.append(item[0]) + tagcloud = {} + for item in taglist: + tagcloud.setdefault(item, taglist.count(item)) + tagcloud = sorted(tagcloud.items(), key=itemgetter(1), reverse=True) + count = 0 + for item, value in tagcloud: + print(ind*6 + "
    • %s (%s)
    • " % (item, item, value)) + count += 1 + if count > int(tags_max): + break + print(ind*5 + "
    ") + print(ind*4 + "
    ") + print(ind*3 + "
    ") + + # Monthlist + if monthlist == "True": + olddate = "" + print(ind*3 + "
    ") + print(ind*4 + "
    %s
    " % blog_locale[1]) + print(ind*4 + "
    ") + print(ind*5 + "
      ") + for entry in entries: + date = time.strftime("%m%Y", entry[0]) + date_display = time.strftime("%h %Y", entry[0]) + if not olddate == date: + print(ind*6 + "
    • %s
    • " % (date, date_display)) + olddate = date + print(ind*5 + "
    ") + print(ind*4 + "
    ") + print(ind*3 + "
    ") + print("") + + # Sidebar ends here + print(ind*2 + "") + print(ind*2 + "") + print(ind*2 + "
    ") - print("") # Staticpage if static_display != "": diff --git a/styles/default/default.css b/styles/default/default.css index a6f954f..9b98c09 100644 --- a/styles/default/default.css +++ b/styles/default/default.css @@ -7,10 +7,9 @@ body, html { background: white; width: 700px; margin: auto; - font-family: sans-serif; - font-size: 0.9em; + font-family: "PT Sans Narrow", sans-serif; + font-size: 12pt; color: #000; - letter-spacing: 0.05em; } img { @@ -18,7 +17,7 @@ img { } a { - color: #999; + color: #666; text-decoration: none; } @@ -30,13 +29,13 @@ a { .rss { position: absolute; - top: 72px; + top: 82px; width: 700px; } .atom { position: absolute; - top: 72px; + top: 82px; margin-left: 20px; width: 700px; } @@ -88,25 +87,21 @@ a { color: black; } - -.months { - width: 700px; +.sidebar { + position: absolute; + right: 100px; + top: 84px; } -.months_list_entry { - list-style-type: none; - display: inline; - text-decoration: none; - font-size: 0.8em; - color: #666; +.linklist_title, .taglist_title, .monthlist_title { + padding-top: 30px; } -.linklist { - position: absolute; - right: 0px; - padding-right: 10px; +.linklist_list, .taglist_list, .monthlist_list { + padding-top: 5px; } + .entries { padding-top: 20px; width: 700px; @@ -118,11 +113,15 @@ a { .entry_title, .entry_title a, .comment_author { font-weight: bold; - font-style: italic; color: black; } -.entry_date, .comment_date, .tags { +.entry_date, .comment_date { + font-size: 0.8em; + color: #666; +} + +.tags { font-size: 0.8em; color: #666; } diff --git a/styles/default/header.txt b/styles/default/header.txt new file mode 100644 index 0000000..e592a83 --- /dev/null +++ b/styles/default/header.txt @@ -0,0 +1 @@ + -- cgit v1.2.3