Some regexp foo

This commit is contained in:
Stefan Ritter 2009-12-06 14:57:47 +01:00
parent 3fcbc1f054
commit e89bbb6bc3

View File

@ -427,7 +427,8 @@ else:
print ' <div class="entry_date">' + date + '</div>' print ' <div class="entry_date">' + date + '</div>'
print ' <div class="entry_content">' print ' <div class="entry_content">'
for line in content: 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): no_break = re.compile('^.*(<ul>|</ul>|<li>|<ol>|</ol>|<table>|</table>|<tr>|</tr>|<td>|</td>).*$')
if re.match(no_break, line):
print ' ' + line.strip() print ' ' + line.strip()
else: else:
print ' ' + line.strip() + '<br />' print ' ' + line.strip() + '<br />'