aboutsummaryrefslogtreecommitdiffstats
path: root/blogthon.cgi
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-12-06 21:50:12 +0100
committerStefan Ritter <xeno@thehappy.de>2009-12-06 21:50:12 +0100
commit338d986fb868795d528f0d5485bb5efa30446866 (patch)
tree70798476553c6d35fc27a13a0b1ed127b2168313 /blogthon.cgi
parentb6341ec2f17cfac4e7a53c8bd4e1e13504a3998a (diff)
Making a wonderful place for regexp and added some more blockelements to the list
Diffstat (limited to '')
-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: