aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xblogthon.cgi6
1 files changed, 4 insertions, 2 deletions
diff --git a/blogthon.cgi b/blogthon.cgi
index a648abe..a9c4023 100755
--- a/blogthon.cgi
+++ b/blogthon.cgi
@@ -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: