From e664b622e9f1c54d3500d571eb9dce087b99732e Mon Sep 17 00:00:00 2001 From: Stefan Ritter Date: Wed, 17 Feb 2010 12:42:22 +0100 Subject: Insert image in staticpageslist instead of title if title.jpg/png/gif exists --- blogthon.cgi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/blogthon.cgi b/blogthon.cgi index 0cf3022..7a3865a 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -32,6 +32,7 @@ import smtplib no_break = re.compile('^\s*(|||||||).*$') line_start_hyphen = re.compile('^-.*$') line_start_plus = re.compile('^\+.*$') +filetype_image = re.compile('.*\.[gG][iI][fF]$|.*\.[pP][nN][gG]$|.*\.[jJ][pP][gG]$') def generate_uuid(string): string_md5sum = md5.new(string).hexdigest() @@ -374,7 +375,12 @@ else: # Staticpages if staticpages == "True": staticpages = [] + staticpages_images = [] staticpages_list = glob.glob(staticpages_dir + '*') + for i in staticpages_list: + if re.match(filetype_image, i): + staticpages_list.remove(i) + staticpages_images.append(i) staticpages_list.sort() print '
' print '
' + blog_locale[0] + '
' @@ -390,7 +396,14 @@ else: link = '?s=' + link file.close() title = re.sub('\w+?\/\d+?-', '', staticpage) - print '
  • ' + title + '
  • ' + if staticpages_images: + for i in staticpages_images: + if staticpage == i[:len(i)-4]: + print '
  • ' + else: + print '
  • ' + title + '
  • ' + else: + print '
  • ' + title + '
  • ' print ' ' print '
    ' print ' ' -- cgit v1.2.3