From 718bb41ff5ab7237cbe141e34925140ea5dd74dc Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Thu, 24 Mar 2011 09:42:08 +0100 Subject: Rename var tab to ind (indention) --- blogthon.cgi | 305 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 153 insertions(+), 152 deletions(-) diff --git a/blogthon.cgi b/blogthon.cgi index 1457a25..b1777b0 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -36,7 +36,8 @@ no_break = re.compile("^\s*(||||") - print(tab + "Error!") - print(tab + "") + print(ind + "Error!") + print(ind + "") print("") print("") - print(tab + "
") - print(tab*2 + "

Error!

") - print(tab*2 + "

" + string + "

") - print(tab + "
") + print(ind + "
") + print(ind*2 + "

Error!

") + print(ind*2 + "

" + string + "

") + print(ind + "
") print("") print("") sys.exit() @@ -285,12 +286,12 @@ if feed_display == "atom": document_header("atom") print("" % blog_url) - print(tab + "") - print(tab*2 + "%s" % blog_title) - print(tab + "") - print(tab + "%s" % blog_title) - print(tab + "urn:uuid:%s" % blog_title_md5sum) - print(tab + "%s-%s-%sT%s:%s:%sZ" % (str(date[0]), month, day, hour, min, sec)) + print(ind + "") + print(ind*2 + "%s" % blog_title) + print(ind + "") + print(ind + "%s" % blog_title) + print(ind + "urn:uuid:%s" % blog_title_md5sum) + print(ind + "%s-%s-%sT%s:%s:%sZ" % (str(date[0]), month, day, hour, min, sec)) print("") j = len(entries) if j > 10: j = 10 @@ -298,42 +299,42 @@ if feed_display == "atom": title = str(entries[i][1]).replace(entries_dir, "", 1).replace("." + entries_suffix, "") date = entries[i][0] title_md5sum = generate_uuid(title) - print(tab*2 + "") - print(tab*3 + "%s" % title) - print(tab*3 + "" % (blog_url, title)) - print(tab*3 + "urn:uuid:%s" % title_md5sum) - print(tab*3 + "%s-%s-%sT%s:%s:%sZ" % (str(date[0]), month, day, hour, min, sec)) - print(tab*3 + "") + print(ind*2 + "") + print(ind*3 + "%s" % title) + print(ind*3 + "" % (blog_url, title)) + print(ind*3 + "urn:uuid:%s" % title_md5sum) + print(ind*3 + "%s-%s-%sT%s:%s:%sZ" % (str(date[0]), month, day, hour, min, sec)) + print(ind*3 + "") content = open(str(entries[i][1]), "r") for h in range(0, int(feed_preview)): rss_line = content.readline().strip() if rss_line != "": - print(tab*4 + rss_line) + print(ind*4 + rss_line) content.close() - print(tab*3 + "") - print(tab*2 + "") + print(ind*3 + "") + print(ind*2 + "") print("") # Generate rss 2.0 feed elif feed_display == "rss": document_header("rss") - print(tab + "") - print(tab*2 + "%s" % blog_title) - print(tab*2 + "%s" % blog_url) - print(tab*2 + "%s" % blog_subtitle) + print(ind + "") + print(ind*2 + "%s" % blog_title) + print(ind*2 + "%s" % blog_url) + print(ind*2 + "%s" % blog_subtitle) date = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(time.mktime(entries[0][0]))) - print(tab*2 + "%s" % date) + print(ind*2 + "%s" % date) print("") j = len(entries) if j > 10: j = 10 for i in range(0, j): title = str(entries[i][1]).replace(entries_dir, "", 1).replace("." + entries_suffix, "") date = time.strftime("%a, %d %b %Y %H:%M:%S %z", time.gmtime(time.mktime(entries[i][0]))) - print(tab*2 + "") - print(tab*3 + "%s" % title) - print(tab*3 + "%s?p=%s" % (blog_url, title)) - print(tab*3 + "%s?p=%s" % (blog_url, title)) - print(tab*3 + "%s" % date) + print(ind*2 + "") + print(ind*3 + "%s" % title) + print(ind*3 + "%s?p=%s" % (blog_url, title)) + print(ind*3 + "%s?p=%s" % (blog_url, title)) + print(ind*3 + "%s" % date) content = open(str(entries[i][1]), "r") rss_description= "" for h in range(0, int(feed_preview)): @@ -341,23 +342,23 @@ elif feed_display == "rss": if line: rss_description = "%s%s
" % (rss_description, line) content.close() - print(tab*3 + "" % rss_description) - print(tab*2 + "
") - print(tab + "
") + print(ind*3 + "" % rss_description) + print(ind*2 + "") + print(ind + "
") print("") # Generate regular page else: document_header("html") - print(tab + "") - print(tab*2 + "%s" % blog_title) - print(tab*2 + "") - print(tab*2 + "") - print(tab*2 + "" % keywords) - print(tab*2 + "" % blog_title) - print(tab*2 + "" % (style, style)) - print(tab + "") - print(tab + "") + print(ind + "") + print(ind*2 + "%s" % blog_title) + print(ind*2 + "") + print(ind*2 + "") + print(ind*2 + "" % keywords) + print(ind*2 + "" % blog_title) + print(ind*2 + "" % (style, style)) + print(ind + "") + print(ind + "") print("") # Plugins @@ -366,26 +367,26 @@ else: __import__ (plugin.split("/")[1].replace(".py", "")) # Site header - print(tab*2 + "
") - print(tab*3 + "
") - print(tab*4 + "%s" % blog_title) - print(tab*3 + "
") - print(tab*3 + "
") - print(tab*4 + "%s" % blog_subtitle) - print(tab*3 + "
") - print(tab*2 + "
") + print(ind*2 + "
") + print(ind*3 + "
") + print(ind*4 + "%s" % blog_title) + print(ind*3 + "
") + print(ind*3 + "
") + print(ind*4 + "%s" % blog_subtitle) + print(ind*3 + "
") + print(ind*2 + "
") print("") # RSS feed - print(tab*2 + "
") - print(tab*3 + "rss") - print(tab*2 + "
") + print(ind*2 + "
") + print(ind*3 + "rss") + print(ind*2 + "
") print("") # Atom feed - print(tab*2 + "
") - print(tab*3 + "atom") - print(tab*2 + "
") + print(ind*2 + "
") + print(ind*3 + "atom") + print(ind*2 + "
") print("") # Staticpages @@ -393,10 +394,10 @@ else: staticpages = [] staticpages_list = glob(os.path.join(staticpages_dir, "*")) staticpages_list.sort() - print(tab*2 + "
") - print(tab*3 + "
%s
" % blog_locale[0]) - print(tab*3 + "
") - print(tab*4 + "
    ") + print(ind*2 + "
    ") + print(ind*3 + "
    %s
    " % blog_locale[0]) + print(ind*3 + "
    ") + print(ind*4 + "
      ") for staticpage in staticpages_list: file = open(staticpage, "r") header = file.readline() @@ -407,77 +408,77 @@ else: link = "?s=%s" % link file.close() title = re.sub("\w+?\/\d+?-", "", staticpage) - print(tab*5 + "
    • %s
    • " % (link, title)) - print(tab*4 + "
    ") - print(tab*3 + "
    ") - print(tab*3 + "
    ") - print(tab*2 + "
    ") + 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(tab*2 + "
") - print(tab*3 + "
%s
" % blog_locale[1]) - print(tab*3 + "
") - print(tab*4 + "
    ") + 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(tab*5 + "
    • %s
    • " % (date, date_display)) + print(ind*5 + "
    • %s
    • " % (date, date_display)) olddate = date - print(tab*4 + "
    ") - print(tab*3 + "
    ") - print(tab*3 + "
    ") - print(tab*2 + "
    ") + print(ind*4 + "
") + print(ind*3 + "
") + print(ind*3 + "
") + print(ind*2 + "
") print("") # Linklist if linklist == "True": - print(tab*2 + "
") - print(tab*3 + "" % blog_locale[2]) - print(tab*3 + "") + print(ind*3 + "") + print(ind*2 + "
") print("") - print(tab*2 + "
") + print(ind*2 + "
") print("") # Staticpage if static_display != "": content = open(os.path.join(staticpages_dir, static_display), "r") - print(tab*3 + "
") - print(tab*4 + "
%s
" % re.sub("^\.", "", re.sub("\d+?-", "", static_display))) - print(tab*4 + "
") - print(tab*5 + "

") + print(ind*3 + "

") + print(ind*4 + "
%s
" % re.sub("^\.", "", re.sub("\d+?-", "", static_display))) + print(ind*4 + "
") + print(ind*5 + "

") for line in content: if no_break.match(line): - print(tab*5 + line.strip()) + print(ind*5 + line.strip()) else: - print(tab*5 + line.strip() + "
") - print(tab*5 + "

") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*3 + "
") + print(ind*5 + line.strip() + "
") + print(ind*5 + "

") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*3 + "
") print("") content.close() @@ -500,24 +501,24 @@ else: if post_display == title.replace(" ", "-") or not post_display: if allentries_display == "1" or entry_counter < entries_per_page: content = open(entry, "r") - print(tab*3 + "
") + print(ind*3 + "
") if permalinks: - print(tab*4 + "" % (title.replace(" ", "-"), title)) + print(ind*4 + "" % (title.replace(" ", "-"), title)) else: - print(tab*4 + "
%s
" % title) - print(tab*4 + "
%s
" % date) - print(tab*4 + "
") + print(ind*4 + "
%s
" % title) + print(ind*4 + "
%s
" % date) + print(ind*4 + "
") for line in content: if no_break.match(line): - print(tab*5 + line.strip()) + print(ind*5 + line.strip()) else: - print(tab*5 + line.strip() + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") - print(tab*4 + "
") + print(ind*5 + line.strip() + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") + print(ind*4 + "
") # Comments... # ... are shown when post_display and comments_file isn't false @@ -525,10 +526,10 @@ else: if post_display: if comments_file: comments_content = open(comments_file[0], "r") - print(tab*3 + "
") - print(tab*2 + "
") + print(ind*3 + "
") + print(ind*2 + "
") print("") - print(tab*2 + "
") + print(ind*2 + "
") notfirstline = 0 # Ugly fix for closing comment containers label_count = 0 @@ -536,83 +537,83 @@ else: for line in comments_content: if line_start_hyphen.match(line): if notfirstline == 1: - print(tab*4 + "
") - print(tab*3 + "
") + print(ind*4 + "") + print(ind*3 + "") notfirstline = 0 - print(tab*3 + "
") + print(ind*3 + "
") # Label for each comment label_count += 1 - print(tab*4 + "" % str(label_count)) + print(ind*4 + "" % str(label_count)) - print(tab*4 + "
%s
" % line.split(".", 1)[1].strip()) + print(ind*4 + "
%s
" % line.split(".", 1)[1].strip()) elif line_start_plus.match(line): - print(tab*4 + "
%s
" % line.split(".", 1)[1].strip()) - print(tab*4 + "
") + print(ind*4 + "
%s
" % line.split(".", 1)[1].strip()) + print(ind*4 + "
") else: notfirstline = 1 line = line.split(".", 1)[1] - print(tab*5 + line.strip() + "
") + print(ind*5 + line.strip() + "
") print("") - print(tab*4 + "
") - print(tab*3 + "
") + print(ind*4 + "
") + print(ind*3 + "
") comments_content.close() else: - print(tab*3 + "") - print(tab*2 + "") - print(tab*2 + "
") + print(ind*3 + "
") + print(ind*2 + "") + print(ind*2 + "
") # Form for adding comments if comments == "True": random_int_a = randint(1,9) random_int_b = randint(1,9) cquizv = random_int_a + random_int_b - print(tab*3 + "
") - print(tab*4 + "
") - print(tab*5 + "" % title) - print(tab*5 + "" % str(cquizv)) - print(tab*5 + "" % blog_locale[6]) - print(tab*5 + "
" % blog_locale[7]) - print(tab*5 + "
" % (str(random_int_a), str(random_int_b))) - print(tab*5 + "
" % blog_locale[8]) - print(tab*4 + "
") - print(tab*3 + "
") + print(ind*3 + "
") + print(ind*4 + "
") + print(ind*5 + "" % title) + print(ind*5 + "" % str(cquizv)) + print(ind*5 + "" % blog_locale[6]) + print(ind*5 + "
" % blog_locale[7]) + print(ind*5 + "
" % (str(random_int_a), str(random_int_b))) + print(ind*5 + "
" % blog_locale[8]) + print(ind*4 + "
") + print(ind*3 + "
") else: - print(tab*3 + "
") + print(ind*3 + "
") print("") if comments == "True": comments_file = glob(os.path.join(entries_dir, title + ".comments")) if not comments_file and not post_display: - print(tab*4 + "
") - print(tab*5 + "%s" % (title.replace(" ", "-"), blog_locale[3])) - print(tab*4 + "
") - print(tab*3 + "
") + print(ind*4 + "
") + print(ind*5 + "%s" % (title.replace(" ", "-"), blog_locale[3])) + print(ind*4 + "
") + print(ind*3 + "") print("") elif comments_file and not post_display: comments_content = open(comments_file[0], "r") comments_counter = 0 for line in comments_content: if line.split(".", 1)[0] == "-": comments_counter += 1 - print(tab*4 + "
") - print(tab*5 + "%s (%s)" % (title.replace(" ", "-"), blog_locale[4], str(comments_counter))) - print(tab*4 + "
") - print(tab*3 + "") + print(ind*4 + "
") + print(ind*5 + "%s (%s)" % (title.replace(" ", "-"), blog_locale[4], str(comments_counter))) + print(ind*4 + "
") + print(ind*3 + "") print("") comments_content.close() else: - print(tab*3 + "") + print(ind*3 + "") print("") content.close() entry_counter += 1 if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist - print(tab*3 + "" % blog_locale[5]) + print(ind*3 + "" % blog_locale[5]) - print(tab*2 + "") + print(ind*2 + "") print("") - print(tab + "") + print(ind + "") print("") # vim: set sw=4 tw=0 ts=4 expandtab: -- cgit v1.2.3