Use print() for python3 compatibility

This commit is contained in:
Stefan Ritter 2011-03-23 14:57:43 +01:00
parent 0f4dabc2dd
commit f9bc02e1c0

View File

@ -39,35 +39,35 @@ def generate_uuid(string):
def errorpage(string): def errorpage(string):
document_header("html") document_header("html")
print "<head>" print("<head>")
print tab + "<title>Error!</title>" print(tab + "<title>Error!</title>")
print tab + "<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css\" />" print(tab + "<link rel=\"stylesheet\" type=\"text/css\" href=\"error.css\" />")
print "</head>" print("</head>")
print "<body>" print("<body>")
print tab + "<div class=\"container\">" print(tab + "<div class=\"container\">")
print tab*2 + "<div class=\"title\"><h1>Error!</h1></div>" print(tab*2 + "<div class=\"title\"><h1>Error!</h1></div>")
print tab*2 + "<div class=\"text\"><h2>" + string + "</h2></div>" print(tab*2 + "<div class=\"text\"><h2>" + string + "</h2></div>")
print tab + "</div>" print(tab + "</div>")
print "</body>" print("</body>")
print "</html>" print("</html>")
sys.exit() sys.exit()
def document_header(string): def document_header(string):
if string == "html": if string == "html":
print "Content-type: text/html\n" print("Content-type: text/html\n")
print "<!DOCTYPE html>" print("<!DOCTYPE html>")
try: try:
print "<html lang=\"" + language + "\">" print("<html lang=\"" + language + "\">")
except NameError: except NameError:
print "<html lang=\"en\">" print("<html lang=\"en\">")
if string == "atom": if string == "atom":
print "Content-type: application/atom+xml\n" print("Content-type: application/atom+xml\n")
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>" print("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
print "<feed xmlns=\"http://www.w3.org/2005/Atom\">" print("<feed xmlns=\"http://www.w3.org/2005/Atom\">")
if string == "rss": if string == "rss":
print "Content-type: application/rss+xml\n" print("Content-type: application/rss+xml\n")
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>" print("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
print "<rss version=\"2.0\">" print("<rss version=\"2.0\">")
# Parse configuration # Parse configuration
configuration = ConfigParser.SafeConfigParser() configuration = ConfigParser.SafeConfigParser()
@ -272,56 +272,56 @@ if feed_display == "atom":
sec = "%(#)02d" % {"#": int(date[5])} sec = "%(#)02d" % {"#": int(date[5])}
document_header("atom") document_header("atom")
print "<link href=\"%s?feed=atom\" rel=\"self\" type=\"application/atom+xml\"/>" % blog_url print("<link href=\"%s?feed=atom\" rel=\"self\" type=\"application/atom+xml\"/>" % blog_url)
print tab + "<author>" print(tab + "<author>")
print tab*2 + "<name>%s</name>" % blog_title print(tab*2 + "<name>%s</name>" % blog_title)
print tab + "</author>" print(tab + "</author>")
print tab + "<title>%s</title>" % blog_title print(tab + "<title>%s</title>" % blog_title)
print tab + "<id>urn:uuid:%s</id>" % blog_title_md5sum print(tab + "<id>urn:uuid:%s</id>" % blog_title_md5sum)
print tab + "<updated>%s-%s-%sT%s:%s:%sZ</updated>" % (str(date[0]), month, day, hour, min, sec) print(tab + "<updated>%s-%s-%sT%s:%s:%sZ</updated>" % (str(date[0]), month, day, hour, min, sec))
print "" print("")
j = len(entries) j = len(entries)
if j > 10: j = 10 if j > 10: j = 10
for i in xrange(0, j): for i in xrange(0, j):
title = str(entries[i][1]).replace(entries_dir, "", 1).replace("." + entries_suffix, "") title = str(entries[i][1]).replace(entries_dir, "", 1).replace("." + entries_suffix, "")
date = entries[i][0] date = entries[i][0]
title_md5sum = generate_uuid(title) title_md5sum = generate_uuid(title)
print tab*2 + "<entry>" print(tab*2 + "<entry>")
print tab*3 + "<title>%s</title>" % title print(tab*3 + "<title>%s</title>" % title)
print tab*3 + "<link href=\"%s?p=%s\"/>" % (blog_url, title) print(tab*3 + "<link href=\"%s?p=%s\"/>" % (blog_url, title))
print tab*3 + "<id>urn:uuid:%s</id>" % title_md5sum print(tab*3 + "<id>urn:uuid:%s</id>" % title_md5sum)
print tab*3 + "<updated>%s-%s-%sT%s:%s:%sZ</updated>" % (str(date[0]), month, day, hour, min, sec) print(tab*3 + "<updated>%s-%s-%sT%s:%s:%sZ</updated>" % (str(date[0]), month, day, hour, min, sec))
print tab*3 + "<summary>" print(tab*3 + "<summary>")
content = open(str(entries[i][1]), "r") content = open(str(entries[i][1]), "r")
for h in xrange(0, int(feed_preview)): for h in xrange(0, int(feed_preview)):
rss_line = content.readline().strip() rss_line = content.readline().strip()
if rss_line != "": if rss_line != "":
print tab*4 + rss_line print(tab*4 + rss_line)
content.close() content.close()
print tab*3 + "</summary>" print(tab*3 + "</summary>")
print tab*2 + "</entry>" print(tab*2 + "</entry>")
print "</feed>" print("</feed>")
# Generate rss 2.0 feed # Generate rss 2.0 feed
elif feed_display == "rss": elif feed_display == "rss":
document_header("rss") document_header("rss")
print tab + "<channel>" print(tab + "<channel>")
print tab*2 + "<title>%s</title>" % blog_title print(tab*2 + "<title>%s</title>" % blog_title)
print tab*2 + "<link>%s</link>" % blog_url print(tab*2 + "<link>%s</link>" % blog_url)
print tab*2 + "<description>%s</description>" % blog_subtitle print(tab*2 + "<description>%s</description>" % blog_subtitle)
date = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(time.mktime(entries[0][0]))) date = time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime(time.mktime(entries[0][0])))
print tab*2 + "<pubDate>%s</pubDate>" % date print(tab*2 + "<pubDate>%s</pubDate>" % date)
print "" print("")
j = len(entries) j = len(entries)
if j > 10: j = 10 if j > 10: j = 10
for i in xrange(0, j): for i in xrange(0, j):
title = str(entries[i][1]).replace(entries_dir, "", 1).replace("." + entries_suffix, "") 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]))) date = time.strftime("%a, %d %b %Y %H:%M:%S %z", time.gmtime(time.mktime(entries[i][0])))
print tab*2 + "<item>" print(tab*2 + "<item>")
print tab*3 + "<title>%s</title>" % title print(tab*3 + "<title>%s</title>" % title)
print tab*3 + "<link>%s?p=%s</link>" % (blog_url, title) print(tab*3 + "<link>%s?p=%s</link>" % (blog_url, title))
print tab*3 + "<guid>%s?p=%s</guid>" % (blog_url, title) print(tab*3 + "<guid>%s?p=%s</guid>" % (blog_url, title))
print tab*3 + "<pubDate>%s</pubDate>" % date print(tab*3 + "<pubDate>%s</pubDate>" % date)
content = open(str(entries[i][1]), "r") content = open(str(entries[i][1]), "r")
rss_description= "" rss_description= ""
for h in xrange(0, int(feed_preview)): for h in xrange(0, int(feed_preview)):
@ -329,24 +329,24 @@ elif feed_display == "rss":
if line: if line:
rss_description = "%s%s<br />" % (rss_description, line) rss_description = "%s%s<br />" % (rss_description, line)
content.close() content.close()
print tab*3 + "<description><![CDATA[%s]]></description>" % rss_description print(tab*3 + "<description><![CDATA[%s]]></description>" % rss_description)
print tab*2 + "</item>" print(tab*2 + "</item>")
print tab + "</channel>" print(tab + "</channel>")
print "</rss>" print("</rss>")
# Generate regular page # Generate regular page
else: else:
document_header("html") document_header("html")
print tab + "<head>" print(tab + "<head>")
print tab*2 + "<title>%s</title>" % blog_title print(tab*2 + "<title>%s</title>" % blog_title)
print tab*2 + "<meta charset=\"utf-8\">" print(tab*2 + "<meta charset=\"utf-8\">")
print tab*2 + "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />" print(tab*2 + "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />")
print tab*2 + "<meta name=\"keywords\" content=\"%s\" />" % keywords print(tab*2 + "<meta name=\"keywords\" content=\"%s\" />" % keywords)
print tab*2 + "<meta name=\"description\" content=\"%s\" />" % blog_title print(tab*2 + "<meta name=\"description\" content=\"%s\" />" % blog_title)
print tab*2 + "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/%s/%s.css\" />" % (style, style) print(tab*2 + "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/%s/%s.css\" />" % (style, style))
print tab + "</head>" print(tab + "</head>")
print tab + "<body>" print(tab + "<body>")
print "" print
# Plugins # Plugins
sys.path.append(plugins_dir) sys.path.append(plugins_dir)
@ -354,37 +354,37 @@ else:
__import__ (plugin.split("/")[1].replace(".py", "")) __import__ (plugin.split("/")[1].replace(".py", ""))
# Site header # Site header
print tab*2 + "<div class=\"header\">" print(tab*2 + "<div class=\"header\">")
print tab*3 + "<div class=\"header_title\">" print(tab*3 + "<div class=\"header_title\">")
print tab*4 + "<a href=\"?\" class=\"header_link\">%s</a>" % blog_title print(tab*4 + "<a href=\"?\" class=\"header_link\">%s</a>" % blog_title)
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*3 + "<div class=\"header_subtitle\">" print(tab*3 + "<div class=\"header_subtitle\">")
print tab*4 + "<span class=\"header_subtitle\">%s</span>" % blog_subtitle print(tab*4 + "<span class=\"header_subtitle\">%s</span>" % blog_subtitle)
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
# RSS feed # RSS feed
print tab*2 + "<div class=\"rss\">" print(tab*2 + "<div class=\"rss\">")
print tab*3 + "<a href=\"?feed=rss\" class=\"rss_link\">rss</a>" print(tab*3 + "<a href=\"?feed=rss\" class=\"rss_link\">rss</a>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
# Atom feed # Atom feed
print tab*2 + "<div class=\"atom\">" print(tab*2 + "<div class=\"atom\">")
print tab*3 + "<a href=\"?feed=atom\" class=\"atom_link\">atom</a>" print(tab*3 + "<a href=\"?feed=atom\" class=\"atom_link\">atom</a>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
# Staticpages # Staticpages
if staticpages == "True": if staticpages == "True":
staticpages = [] staticpages = []
staticpages_list = glob(os.path.join(staticpages_dir, "*")) staticpages_list = glob(os.path.join(staticpages_dir, "*"))
staticpages_list.sort() staticpages_list.sort()
print tab*2 + "<div class=\"pages\">" print(tab*2 + "<div class=\"pages\">")
print tab*3 + "<div class=\"pages_title\">%s</div>" % blog_locale[0] print(tab*3 + "<div class=\"pages_title\">%s</div>" % blog_locale[0])
print tab*3 + "<div class=\"pages_list\">" print(tab*3 + "<div class=\"pages_list\">")
print tab*4 + "<ul class=\"pages_list\">" print(tab*4 + "<ul class=\"pages_list\">")
for staticpage in staticpages_list: for staticpage in staticpages_list:
file = open(staticpage, "r") file = open(staticpage, "r")
header = file.readline() header = file.readline()
@ -395,78 +395,78 @@ else:
link = "?s=%s" % link link = "?s=%s" % link
file.close() file.close()
title = re.sub("\w+?\/\d+?-", "", staticpage) title = re.sub("\w+?\/\d+?-", "", staticpage)
print tab*5 + "<li class=\"pages_list_entry\"><a href=\"%s\" class=\"pages_list_entry\">%s</a></li>" % (link, title) print(tab*5 + "<li class=\"pages_list_entry\"><a href=\"%s\" class=\"pages_list_entry\">%s</a></li>" % (link, title))
print tab*4 + "</ul>" print(tab*4 + "</ul>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*3 + "<div class=\"pages_footer\"></div>" print(tab*3 + "<div class=\"pages_footer\"></div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
# Monthlist # Monthlist
if monthlist == "True": if monthlist == "True":
olddate = "" olddate = ""
print tab*2 + "<div class=\"months\">" print(tab*2 + "<div class=\"months\">")
print tab*3 + "<div class=\"months_title\">%s</div>" % blog_locale[1] print(tab*3 + "<div class=\"months_title\">%s</div>" % blog_locale[1])
print tab*3 + "<div class=\"months_list\">" print(tab*3 + "<div class=\"months_list\">")
print tab*4 + "<ul class=\"months_list\">" print(tab*4 + "<ul class=\"months_list\">")
for entry in entries: for entry in entries:
date = time.strftime("%m%Y", entry[0]) date = time.strftime("%m%Y", entry[0])
date_display = time.strftime("%h %Y", entry[0]) date_display = time.strftime("%h %Y", entry[0])
if not olddate == date: if not olddate == date:
print tab*5 + "<li class=\"months_list_entry\"><a href=\"?m=%s\" class=\"months_list_entry\">%s</a></li>" % (date, date_display) print(tab*5 + "<li class=\"months_list_entry\"><a href=\"?m=%s\" class=\"months_list_entry\">%s</a></li>" % (date, date_display))
olddate = date olddate = date
print tab*4 + "</ul>" print(tab*4 + "</ul>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*3 + "<div class=\"months_footer\"></div>" print(tab*3 + "<div class=\"months_footer\"></div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
# Linklist # Linklist
if linklist == "True": if linklist == "True":
print tab*2 + "<div class=\"linklist\">" print(tab*2 + "<div class=\"linklist\">")
print tab*3 + "<div class=\"linklist_title\">%s</div>" % blog_locale[2] print(tab*3 + "<div class=\"linklist_title\">%s</div>" % blog_locale[2])
print tab*3 + "<div class=\"linklist_list\">" print(tab*3 + "<div class=\"linklist_list\">")
print tab*4 + "<ul class=\"linklist_list\">" print(tab*4 + "<ul class=\"linklist_list\">")
try: try:
content = open("linklist", "r") content = open("linklist", "r")
for line in content: for line in content:
if line.strip() is "": if line.strip() is "":
print "<br />" print("<br />")
else: else:
print tab*5 + "<li class=\"linklist_list_entry\"><a href=\"%s\" class=\"months_list_entry\">%s</a></li>" % (line.split(" ")[0], line.split(" ", 1)[1].strip()) print(tab*5 + "<li class=\"linklist_list_entry\"><a href=\"%s\" class=\"months_list_entry\">%s</a></li>" % (line.split(" ")[0], line.split(" ", 1)[1].strip()))
content.close() content.close()
except: except:
print "" print("")
print tab*4 + "</ul>" print(tab*4 + "</ul>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*3 + "<div class=\"linklist_footer\"></div>" print(tab*3 + "<div class=\"linklist_footer\"></div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
print tab*2 + "<div class=\"entries\">" print(tab*2 + "<div class=\"entries\">")
print "" print("")
# Staticpage # Staticpage
if static_display != "": if static_display != "":
content = open(os.path.join(staticpages_dir, static_display), "r") content = open(os.path.join(staticpages_dir, static_display), "r")
print tab*3 + "<div class=\"entry\">" print(tab*3 + "<div class=\"entry\">")
print tab*4 + "<div class=\"entry_title\">%s</div>" % re.sub("^\.", "", re.sub("\d+?-", "", static_display)) print(tab*4 + "<div class=\"entry_title\">%s</div>" % re.sub("^\.", "", re.sub("\d+?-", "", static_display)))
print tab*4 + "<div class=\"entry_content\">" print(tab*4 + "<div class=\"entry_content\">")
print tab*5 + "<p>" print(tab*5 + "<p>")
for line in content: for line in content:
if no_break.match(line): if no_break.match(line):
print tab*5 + line.strip() print(tab*5 + line.strip())
else: else:
print tab*5 + line.strip() + "<br />" print(tab*5 + line.strip() + "<br />")
print tab*5 + "</p>" print(tab*5 + "</p>")
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*4 + "<div class=\"entry_footer\"></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_left\"></div>")
print tab*4 + "<div class=\"entry_border_right\"></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_top\"></div>")
print tab*4 + "<div class=\"entry_border_bottom\"></div>" print(tab*4 + "<div class=\"entry_border_bottom\"></div>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print "" print("")
content.close() content.close()
# Entry # Entry
@ -488,24 +488,24 @@ else:
if post_display == title.replace(" ", "-") or not post_display: if post_display == title.replace(" ", "-") or not post_display:
if allentries_display == "1" or entry_counter < entries_per_page: if allentries_display == "1" or entry_counter < entries_per_page:
content = open(entry, "r") content = open(entry, "r")
print tab*3 + "<div class=\"entry\">" print(tab*3 + "<div class=\"entry\">")
if permalinks: if permalinks:
print tab*4 + "<div class=\"entry_title\"><a href=\"?p=%s\" class=\"entry_title\">%s</a></div>" % (title.replace(" ", "-"), title) print(tab*4 + "<div class=\"entry_title\"><a href=\"?p=%s\" class=\"entry_title\">%s</a></div>" % (title.replace(" ", "-"), title))
else: else:
print tab*4 + "<div class=\"entry_title\">%s</div>" % title print(tab*4 + "<div class=\"entry_title\">%s</div>" % title)
print tab*4 + "<div class=\"entry_date\">%s</div>" % date print(tab*4 + "<div class=\"entry_date\">%s</div>" % date)
print tab*4 + "<div class=\"entry_content\">" print(tab*4 + "<div class=\"entry_content\">")
for line in content: for line in content:
if no_break.match(line): if no_break.match(line):
print tab*5 + line.strip() print(tab*5 + line.strip())
else: else:
print tab*5 + line.strip() + "<br />" print(tab*5 + line.strip() + "<br />")
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*4 + "<div class=\"entry_footer\"></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_left\"></div>")
print tab*4 + "<div class=\"entry_border_right\"></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_top\"></div>")
print tab*4 + "<div class=\"entry_border_bottom\"></div>" print(tab*4 + "<div class=\"entry_border_bottom\"></div>")
# Comments... # Comments...
# ... are shown when post_display and comments_file isn't false # ... are shown when post_display and comments_file isn't false
@ -513,10 +513,10 @@ else:
if post_display: if post_display:
if comments_file: if comments_file:
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
print tab*2 + "<div class=\"comments\">" print(tab*2 + "<div class=\"comments\">")
notfirstline = 0 # Ugly fix for closing comment containers notfirstline = 0 # Ugly fix for closing comment containers
label_count = 0 label_count = 0
@ -524,83 +524,83 @@ else:
for line in comments_content: for line in comments_content:
if line_start_hyphen.match(line): if line_start_hyphen.match(line):
if notfirstline == 1: if notfirstline == 1:
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*3 + "</div>" print(tab*3 + "</div>")
notfirstline = 0 notfirstline = 0
print tab*3 + "<div class=\"comment\">" print(tab*3 + "<div class=\"comment\">")
# Label for each comment # Label for each comment
label_count += 1 label_count += 1
print tab*4 + "<a name=\"%s\"></a>" % str(label_count) print(tab*4 + "<a name=\"%s\"></a>" % str(label_count))
print tab*4 + "<div class=\"comment_author\">%s</div>" % line.split(".", 1)[1].strip() print(tab*4 + "<div class=\"comment_author\">%s</div>" % line.split(".", 1)[1].strip())
elif line_start_plus.match(line): elif line_start_plus.match(line):
print tab*4 + "<div class=\"comment_date\">%s</div>" % line.split(".", 1)[1].strip() print(tab*4 + "<div class=\"comment_date\">%s</div>" % line.split(".", 1)[1].strip())
print tab*4 + "<div class=\"comment_content\">" print(tab*4 + "<div class=\"comment_content\">")
else: else:
notfirstline = 1 notfirstline = 1
line = line.split(".", 1)[1] line = line.split(".", 1)[1]
print tab*5 + line.strip() + "<br />" print(tab*5 + line.strip() + "<br />")
print "" print("")
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*3 + "</div>" print(tab*3 + "</div>")
comments_content.close() comments_content.close()
else: else:
print tab*3 + "</div>" print(tab*3 + "</div>")
print tab*2 + "</div>" print(tab*2 + "</div>")
print tab*2 + "<div class=\"comments\">" print(tab*2 + "<div class=\"comments\">")
# Form for adding comments # Form for adding comments
if comments == "True": if comments == "True":
random_int_a = randint(1,9) random_int_a = randint(1,9)
random_int_b = randint(1,9) random_int_b = randint(1,9)
cquizv = random_int_a + random_int_b cquizv = random_int_a + random_int_b
print tab*3 + "<div class=\"submit_comment\">" print(tab*3 + "<div class=\"submit_comment\">")
print tab*4 + "<form action=\"\" method=\"post\">" print(tab*4 + "<form action=\"\" method=\"post\">")
print tab*5 + "<input type=\"hidden\" name=\"ctitle\" value=\"%s\" />" % title print(tab*5 + "<input type=\"hidden\" name=\"ctitle\" value=\"%s\" />" % title)
print tab*5 + "<input type=\"hidden\" name=\"cquizv\" value=\"%s\" />" % str(cquizv) print(tab*5 + "<input type=\"hidden\" name=\"cquizv\" value=\"%s\" />" % str(cquizv))
print tab*5 + "<label class=\"submit_comment_name\">%s:</label><input class=\"submit_comment_name_input\" type=\"text\" id=\"cname\" name=\"cname\" />" % blog_locale[6] print(tab*5 + "<label class=\"submit_comment_name\">%s:</label><input class=\"submit_comment_name_input\" type=\"text\" id=\"cname\" name=\"cname\" />" % blog_locale[6])
print tab*5 + "<br /><label class=\"submit_comment_text\">%s:</label><textarea class=\"submit_comment_textarea\" id=\"ctext\" name=\"ctext\"></textarea>" % blog_locale[7] print(tab*5 + "<br /><label class=\"submit_comment_text\">%s:</label><textarea class=\"submit_comment_textarea\" id=\"ctext\" name=\"ctext\"></textarea>" % blog_locale[7])
print tab*5 + "<br /><label class=\"submit_comment_quiz\">%s+%s=</label><input class=\"submit_comment_quiz_input\" type=\"text\" id=\"cquiz\" name=\"cquiz\" />" % (str(random_int_a), str(random_int_b)) print(tab*5 + "<br /><label class=\"submit_comment_quiz\">%s+%s=</label><input class=\"submit_comment_quiz_input\" type=\"text\" id=\"cquiz\" name=\"cquiz\" />" % (str(random_int_a), str(random_int_b)))
print tab*5 + "<br /><input class=\"submit_comment_button\" type=\"submit\" id=\"submit\" value=\"%s\" />" % blog_locale[8] print(tab*5 + "<br /><input class=\"submit_comment_button\" type=\"submit\" id=\"submit\" value=\"%s\" />" % blog_locale[8])
print tab*4 + "</form>" print(tab*4 + "</form>")
print tab*3 + "</div>" print(tab*3 + "</div>")
else: else:
print tab*3 + "<div class=\"submit_border_bottom\"></div>" print(tab*3 + "<div class=\"submit_border_bottom\"></div>")
print "" print("")
if comments == "True": if comments == "True":
comments_file = glob(os.path.join(entries_dir, title + ".comments")) comments_file = glob(os.path.join(entries_dir, title + ".comments"))
if not comments_file and not post_display: if not comments_file and not post_display:
print tab*4 + "<div class=\"entry_comment\">" print(tab*4 + "<div class=\"entry_comment\">")
print tab*5 + "<a href=\"?p=%s\" class=\"entry_comment\">%s</a>" % (title.replace(" ", "-"), blog_locale[3]) print(tab*5 + "<a href=\"?p=%s\" class=\"entry_comment\">%s</a>" % (title.replace(" ", "-"), blog_locale[3]))
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print "" print("")
elif comments_file and not post_display: elif comments_file and not post_display:
comments_content = open(comments_file[0], "r") comments_content = open(comments_file[0], "r")
comments_counter = 0 comments_counter = 0
for line in comments_content: for line in comments_content:
if line.split(".", 1)[0] == "-": comments_counter += 1 if line.split(".", 1)[0] == "-": comments_counter += 1
print tab*4 + "<div class=\"entry_comment\">" print(tab*4 + "<div class=\"entry_comment\">")
print tab*5 + "<a href=\"?p=%s\" class=\"entry_comment\">%s (%s)</a>" % (title.replace(" ", "-"), blog_locale[4], str(comments_counter)) print(tab*5 + "<a href=\"?p=%s\" class=\"entry_comment\">%s (%s)</a>" % (title.replace(" ", "-"), blog_locale[4], str(comments_counter)))
print tab*4 + "</div>" print(tab*4 + "</div>")
print tab*3 + "</div>" print(tab*3 + "</div>")
print "" print("")
comments_content.close() comments_content.close()
else: else:
print tab*3 + "</div>" print(tab*3 + "</div>")
print "" print("")
content.close() content.close()
entry_counter += 1 entry_counter += 1
if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist if not month_display and not post_display and not allentries_display and entry_counter == entries_per_page: # Display pagelist
print tab*3 + "<div class=\"show_all\"><a href=\"?a=1\">%s</a></div>" % blog_locale[5] print(tab*3 + "<div class=\"show_all\"><a href=\"?a=1\">%s</a></div>" % blog_locale[5])
print tab*2 + "</div>" print(tab*2 + "</div>")
print "" print("")
print tab + "</body>" print(tab + "</body>")
print "</html>" print("</html>")
# vim: set sw=4 tw=0 ts=4 expandtab: # vim: set sw=4 tw=0 ts=4 expandtab: