Making a wonderful place for regexp and added some more blockelements to the list

This commit is contained in:
Stefan Ritter 2009-12-06 21:50:12 +01:00
parent b6341ec2f1
commit 338d986fb8
1 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,9 @@
import cgi, os, time, glob, re, md5, sys, random, smtplib
import ConfigParser
# A wonderful place for doing some regexp ;)
no_break = re.compile('^\s*(<ul>|</ul>|<li>|<ol>|</ol>|<table>|</table>|<tr>|</tr>|<td>|</td>|<th>|</th>|<p>|</p>).*$')
def generate_uuid(string):
string_md5sum = md5.new(string).hexdigest()
string = str.join('-', (string_md5sum[0:8], string_md5sum[8:12], string_md5sum[12:16], string_md5sum[16:20], string_md5sum[20:32]))
@ -407,7 +410,7 @@ else:
print ' <div class="entry_content">'
print ' <p>'
for line in content:
if re.search('<li>', line) or re.search('<ul>', line) or re.search('</ul>', line) or re.search('<ol>', line) or re.search('</ol>', line):
if re.match(no_break, line):
print ' ' + line.strip()
else:
print ' ' + line.strip() + '<br />'
@ -443,7 +446,6 @@ else:
print ' <div class="entry_date">' + date + '</div>'
print ' <div class="entry_content">'
for line in content:
no_break = re.compile('^.*(<ul>|</ul>|<li>|<ol>|</ol>|<table>|</table>|<tr>|</tr>|<td>|</td>).*$')
if re.match(no_break, line):
print ' ' + line.strip()
else: