aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xblogthon.cgi188
1 files changed, 93 insertions, 95 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index 6c48081..63d0e2f 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -270,12 +270,12 @@ if feed_display == "atom":
document_header("atom")
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
- print ' <author>'
- print ' <name>' + blog_title + '</name>'
- print ' </author>'
- print ' <title>' + blog_title + '</title>'
- print ' <id>urn:uuid:' + blog_title_md5sum + '</id>'
- print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
+ print tab + '<author>'
+ print tab*2 + '<name>' + blog_title + '</name>'
+ print tab + '</author>'
+ print tab + '<title>' + blog_title + '</title>'
+ print tab + '<id>urn:uuid:' + blog_title_md5sum + '</id>'
+ print tab + '<updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
print ''
j = len(entries)
if j > 10: j = 10
@@ -283,44 +283,42 @@ if feed_display == "atom":
title = str(entries[i][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
date = entries[i][0]
title_md5sum = generate_uuid(title)
- print ' <entry>'
- print ' <title>' + title + '</title>'
- print ' <link href="' + blog_url + '?p=' + title + '"/>'
- print ' <id>urn:uuid:' + title_md5sum + '</id>'
- print ' <updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
- print ' <summary>'
+ print tab*2 + '<entry>'
+ print tab*3 + '<title>' + title + '</title>'
+ print tab*3 + '<link href="' + blog_url + '?p=' + title + '"/>'
+ print tab*3 + '<id>urn:uuid:' + title_md5sum + '</id>'
+ print tab*3 + '<updated>' + str(date[0]) + '-' + month + '-' + day + 'T' + hour + ':' + min + ':' + sec + 'Z</updated>'
+ print tab*3 + '<summary>'
content = open(str(entries[i][1]), 'r')
for h in xrange(0, int(feed_preview)):
rss_line = content.readline().strip()
if rss_line != '':
print ' ' + rss_line
content.close()
- print ' </summary>'
- print ' </entry>'
+ print tab*3 + '</summary>'
+ print tab*2 + '</entry>'
print '</feed>'
# Generate rss 2.0 feed
elif feed_display == "rss":
document_header("rss")
- print ' <channel>'
- print ' <title>' + blog_title + '</title>'
- print ' <link>' + blog_url + '</link>'
- print ' <description>' + blog_subtitle + '</description>'
+ print tab + '<channel>'
+ print tab*2 + '<title>' + blog_title + '</title>'
+ print tab*2 + '<link>' + blog_url + '</link>'
+ print tab*2 + '<description>' + blog_subtitle + '</description>'
date = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(time.mktime(entries[0][0])))
- print ' <pubDate>' + date + '</pubDate>'
+ print tab*2 + '<pubDate>' + date + '</pubDate>'
print ''
j = len(entries)
if j > 10: j = 10
for i in xrange(0, j):
title = str(entries[i][1]).replace('entries/', '', 1).replace('.' + entries_suffix, '')
date = time.strftime("%a, %d %b %Y %H:%M:%S %z", time.gmtime(time.mktime(entries[i][0])))
- title_md5sum = generate_uuid(title)
- print ' <item>'
- print ' <title>' + title + '</title>'
- print ' <link>' + blog_url + '?p=' + title + '</link>'
- #print ' <guid>' + title_md5sum + '</guid>'
- print ' <guid>' + blog_url + '?p=' + title + '</guid>'
- print ' <pubDate>' + date + '</pubDate>'
+ print tab*2 + '<item>'
+ print tab*3 + '<title>' + title + '</title>'
+ print tab*3 + '<link>' + blog_url + '?p=' + title + '</link>'
+ print tab*3 + '<guid>' + blog_url + '?p=' + title + '</guid>'
+ print tab*3 + '<pubDate>' + date + '</pubDate>'
content = open(str(entries[i][1]), 'r')
rss_description= ''
for h in xrange(0, int(feed_preview)):
@@ -328,9 +326,9 @@ elif feed_display == "rss":
if line:
rss_description = rss_description + line + '<br />'
content.close()
- print ' <description><![CDATA[' + rss_description + ']]></description>'
- print ' </item>'
- print ' </channel>'
+ print tab*3 + '<description><![CDATA[' + rss_description + ']]></description>'
+ print tab*2 + '</item>'
+ print tab + '</channel>'
print '</rss>'
# Generate regular page
@@ -447,23 +445,23 @@ else:
# Staticpage
if static_display != "":
content = open(staticpages_dir + static_display, "r")
- print ' <div class="entry">'
- print ' <div class="entry_title">' + re.sub('^\.', '', re.sub('\d+?-', '', static_display)) + '</div>'
- print ' <div class="entry_content">'
- print ' <p>'
+ print tab*3 + '<div class="entry">'
+ print tab*4 + '<div class="entry_title">' + re.sub('^\.', '', re.sub('\d+?-', '', static_display)) + '</div>'
+ print tab*4 + '<div class="entry_content">'
+ print tab*5 + '<p>'
for line in content:
if no_break.match(line):
- print ' ' + line.strip()
+ print tab*5 + line.strip()
else:
- print ' ' + line.strip() + '<br />'
- print ' </p>'
- print ' </div>'
- print ' <div class="entry_footer"></div>'
- print ' <div class="entry_border_left"></div>'
- print ' <div class="entry_border_right"></div>'
- print ' <div class="entry_border_top"></div>'
- print ' <div class="entry_border_bottom"></div>'
- print ' </div>'
+ print tab*5 + line.strip() + '<br />'
+ print tab*5 + '</p>'
+ print tab*4 + '</div>'
+ print tab*4 + '<div class="entry_footer"></div>'
+ print tab*4 + '<div class="entry_border_left"></div>'
+ print tab*4 + '<div class="entry_border_right"></div>'
+ print tab*4 + '<div class="entry_border_top"></div>'
+ print tab*4 + '<div class="entry_border_bottom"></div>'
+ print tab*3 + '</div>'
print ''
content.close()
@@ -481,24 +479,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 ' <div class="entry">'
+ print tab*3 + '<div class="entry">'
if permalinks:
- print ' <div class="entry_title"><a href="?p=' + title.replace(' ', '-') + '" class="entry_title">' + title + '</a></div>'
+ print tab*4 + '<div class="entry_title"><a href="?p=' + title.replace(' ', '-') + '" class="entry_title">' + title + '</a></div>'
else:
- print ' <div class="entry_title">' + title + '</div>'
- print ' <div class="entry_date">' + date + '</div>'
- print ' <div class="entry_content">'
+ print tab*4 + '<div class="entry_title">' + title + '</div>'
+ print tab*4 + '<div class="entry_date">' + date + '</div>'
+ print tab*4 + '<div class="entry_content">'
for line in content:
if no_break.match(line):
- print ' ' + line.strip()
+ print tab*5 + line.strip()
else:
- print ' ' + line.strip() + '<br />'
- print ' </div>'
- print ' <div class="entry_footer"></div>'
- print ' <div class="entry_border_left"></div>'
- print ' <div class="entry_border_right"></div>'
- print ' <div class="entry_border_top"></div>'
- print ' <div class="entry_border_bottom"></div>'
+ print tab*5 + line.strip() + '<br />'
+ print tab*4 + '</div>'
+ print tab*4 + '<div class="entry_footer"></div>'
+ print tab*4 + '<div class="entry_border_left"></div>'
+ print tab*4 + '<div class="entry_border_right"></div>'
+ print tab*4 + '<div class="entry_border_top"></div>'
+ print tab*4 + '<div class="entry_border_bottom"></div>'
# Comments...
# ... are shown when post_display and comments_file isn't false
@@ -507,10 +505,10 @@ else:
if comments_file:
comments_file = glob.glob(entries_dir + title + '.comments')
comments_content = open(comments_file[0], "r")
- print ' </div>'
- print ' </div>'
+ print tab*3 + '</div>'
+ print tab*2 + '</div>'
print ''
- print ' <div class="comments">'
+ print tab*2 + '<div class="comments">'
notfirstline = 0 # Ugly fix for closing comment containers
label_count = 0
@@ -518,83 +516,83 @@ else:
for line in comments_content:
if line_start_hyphen.match(line):
if notfirstline == 1:
- print ' </div>'
- print ' </div>'
+ print tab*4 + '</div>'
+ print tab*3 + '</div>'
notfirstline = 0;
- print ' <div class="comment">'
+ print tab*3 + '<div class="comment">'
#Label for each comment
label_count += 1
- print ' <a name="' + str(label_count) + '"></a>'
+ print tab*4 + '<a name="' + str(label_count) + '"></a>'
- print ' <div class="comment_author">' + line.split(".", 1)[1].strip() + '</div>'
+ print tab*4 + '<div class="comment_author">' + line.split(".", 1)[1].strip() + '</div>'
elif line_start_plus.match(line):
- print ' <div class="comment_date">' + line.split(".", 1)[1].strip() + '</div>'
- print ' <div class="comment_content">'
+ print tab*4 + '<div class="comment_date">' + line.split(".", 1)[1].strip() + '</div>'
+ print tab*4 + '<div class="comment_content">'
else:
notfirstline = 1;
line = line.split(".", 1)[1]
- print ' ' + line.strip() + '<br />'
+ print tab*5 + line.strip() + '<br />'
print ''
- print ' </div>'
- print ' </div>'
+ print tab*4 + '</div>'
+ print tab*3 + '</div>'
comments_content.close()
else:
- print ' </div>'
- print ' </div>'
- print ' <div class="comments">'
+ print tab*3 + '</div>'
+ print tab*2 + '</div>'
+ print tab*2 + '<div class="comments">'
# Form for adding comments
if comments == "True":
random_int_a = random.randint(1,9)
random_int_b = random.randint(1,9)
cquizv = random_int_a + random_int_b
- print ' <div class="submit_comment">'
- print ' <form action="" method="post">'
- print ' <input type="hidden" name="ctitle" value="' + title + '" />'
- print ' <input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
- print ' <label class="submit_comment_name">' + blog_locale[6] + ':</label><input class="submit_comment_name_input" type="text" id="cname" name="cname" />'
- print ' <br /><label class="submit_comment_text">' + blog_locale[7] + ':</label><textarea class="submit_comment_textarea" id="ctext" name="ctext"></textarea>'
- print ' <br /><label class="submit_comment_quiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input class="submit_comment_quiz_input" type="text" id="cquiz" name="cquiz" />'
- print ' <br /><input class="submit_comment_button" type="submit" id="submit" value="' + blog_locale[8] + '" />'
- print ' </form>'
- print ' </div>'
+ print tab*3 + '<div class="submit_comment">'
+ print tab*4 + '<form action="" method="post">'
+ print tab*5 + '<input type="hidden" name="ctitle" value="' + title + '" />'
+ print tab*5 + '<input type="hidden" name="cquizv" value="' + str(cquizv) + '" />'
+ print tab*5 + '<label class="submit_comment_name">' + blog_locale[6] + ':</label><input class="submit_comment_name_input" type="text" id="cname" name="cname" />'
+ print tab*5 + '<br /><label class="submit_comment_text">' + blog_locale[7] + ':</label><textarea class="submit_comment_textarea" id="ctext" name="ctext"></textarea>'
+ print tab*5 + '<br /><label class="submit_comment_quiz">' + str(random_int_a) + '+' + str(random_int_b) + '=</label><input class="submit_comment_quiz_input" type="text" id="cquiz" name="cquiz" />'
+ print tab*5 + '<br /><input class="submit_comment_button" type="submit" id="submit" value="' + blog_locale[8] + '" />'
+ print tab*4 + '</form>'
+ print tab*3 + '</div>'
else:
- print ' <div class="submit_border_bottom"></div>'
+ print tab*3 + '<div class="submit_border_bottom"></div>'
print ''
if comments == "True":
comments_file = glob.glob(entries_dir + title + '.comments')
if not comments_file and not post_display:
- print ' <div class="entry_comment">'
- print ' <a href="?p=' + title.replace(' ','-') + '" class="entry_comment">' + blog_locale[3] + '</a>'
- print ' </div>'
- print ' </div>'
+ print tab*4 + '<div class="entry_comment">'
+ print tab*5 + '<a href="?p=' + title.replace(' ','-') + '" class="entry_comment">' + blog_locale[3] + '</a>'
+ print tab*4 + '</div>'
+ print tab*3 + '</div>'
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 ' <div class="entry_comment">'
- print ' <a href="?p=' + title.replace(' ', '-') + '" class="entry_comment">' + blog_locale[4] + ' (' + str(comments_counter) + ')</a>'
- print ' </div>'
- print ' </div>'
+ print tab*4 + '<div class="entry_comment">'
+ print tab*5 + '<a href="?p=' + title.replace(' ', '-') + '" class="entry_comment">' + blog_locale[4] + ' (' + str(comments_counter) + ')</a>'
+ print tab*4 + '</div>'
+ print tab*3 + '</div>'
print ''
comments_content.close()
else:
- print ' </div>'
+ print tab*3 + '</div>'
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 ' <div class="entry"><a href="?a=1">' + blog_locale[5] + '</a></div>'
+ print tab*3 + '<div class="entry"><a href="?a=1">' + blog_locale[5] + '</a></div>'
- print ' </div>'
+ print tab*2 + '</div>'
print ''
- print ' </body>'
+ print tab + '</body>'
print '</html>'
# vim: set tw=0 ts=4: