Insert image in staticpageslist instead of title if title.jpg/png/gif exists
This commit is contained in:
parent
2676322ded
commit
e664b622e9
15
blogthon.cgi
15
blogthon.cgi
@ -32,6 +32,7 @@ import smtplib
|
|||||||
no_break = re.compile('^\s*(<ul|</ul>|<li|</li>|<ol|</ol>|<table|</table>|<tr|</tr>|<td|</td>|<th|</th>|<p|</p>).*$')
|
no_break = re.compile('^\s*(<ul|</ul>|<li|</li>|<ol|</ol>|<table|</table>|<tr|</tr>|<td|</td>|<th|</th>|<p|</p>).*$')
|
||||||
line_start_hyphen = re.compile('^-.*$')
|
line_start_hyphen = re.compile('^-.*$')
|
||||||
line_start_plus = re.compile('^\+.*$')
|
line_start_plus = re.compile('^\+.*$')
|
||||||
|
filetype_image = re.compile('.*\.[gG][iI][fF]$|.*\.[pP][nN][gG]$|.*\.[jJ][pP][gG]$')
|
||||||
|
|
||||||
def generate_uuid(string):
|
def generate_uuid(string):
|
||||||
string_md5sum = md5.new(string).hexdigest()
|
string_md5sum = md5.new(string).hexdigest()
|
||||||
@ -374,7 +375,12 @@ else:
|
|||||||
# Staticpages
|
# Staticpages
|
||||||
if staticpages == "True":
|
if staticpages == "True":
|
||||||
staticpages = []
|
staticpages = []
|
||||||
|
staticpages_images = []
|
||||||
staticpages_list = glob.glob(staticpages_dir + '*')
|
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()
|
staticpages_list.sort()
|
||||||
print ' <div class="pages">'
|
print ' <div class="pages">'
|
||||||
print ' <div class="pages_title">' + blog_locale[0] + '</div>'
|
print ' <div class="pages_title">' + blog_locale[0] + '</div>'
|
||||||
@ -390,7 +396,14 @@ else:
|
|||||||
link = '?s=' + link
|
link = '?s=' + link
|
||||||
file.close()
|
file.close()
|
||||||
title = re.sub('\w+?\/\d+?-', '', staticpage)
|
title = re.sub('\w+?\/\d+?-', '', staticpage)
|
||||||
print ' <li class="pages_list_entry"><a href="' + link + '" class="pages_list_entry">' + title + '</a></li>'
|
if staticpages_images:
|
||||||
|
for i in staticpages_images:
|
||||||
|
if staticpage == i[:len(i)-4]:
|
||||||
|
print ' <li class="pages_list_entry"><a href="' + link + '" class="pages_list_entry"><img src="' + i + '"></a></li>'
|
||||||
|
else:
|
||||||
|
print ' <li class="pages_list_entry"><a href="' + link + '" class="pages_list_entry">' + title + '</a></li>'
|
||||||
|
else:
|
||||||
|
print ' <li class="pages_list_entry"><a href="' + link + '" class="pages_list_entry">' + title + '</a></li>'
|
||||||
print ' </ul>'
|
print ' </ul>'
|
||||||
print ' </div>'
|
print ' </div>'
|
||||||
print ' <div class="pages_footer"></div>'
|
print ' <div class="pages_footer"></div>'
|
||||||
|
Loading…
Reference in New Issue
Block a user