Regexp that converts underscores in filenames to minus

This commit is contained in:
Stefan Ritter 2009-07-06 16:17:42 +02:00
parent be155b1810
commit b60d9c00a7
1 changed files with 4 additions and 3 deletions

View File

@ -123,8 +123,9 @@ except: errorpage("newest_first")
# Read POST Variables
action = cgi.FieldStorage()
month_display = action.getvalue('m')
post_display = action.getvalue('p')
static_display = action.getvalue('s')
post_display = action.getvalue('p')
if post_display: post_display = re.sub(' ', '-', post_display)
allentries_display = action.getvalue('a')
feed_display = action.getvalue('feed')
if not month_display: month_display = ""
@ -379,12 +380,12 @@ else:
title = title.replace('.' + entries_suffix, '')
if month_display == date_to_compare or not month_display:
if post_display == title or not post_display:
if post_display == re.sub(' ', '-', title) or not post_display:
if allentries_display == "1" or entry_counter < entries_per_page:
content = open(entry, "r")
print ' <div class="entry">'
if permalinks:
print ' <div class="entry_title"><a href="?p=' + title + '" class="entry_title">' + title + '</a></div>'
print ' <div class="entry_title"><a href="?p=' + re.sub(' ', '-', title) + '" class="entry_title">' + title + '</a></div>'
else:
print ' <div class="entry_title">' + title + '</div>'
print ' <div class="entry_date">' + date + '</div>'